I have a gridded temperature dataset df (time: 2920 x: 349 y: 277) and a land sea mask for the same grid mf (time: 1 x: 349 y: 277) where mf.land = 1 for land grid points and mf.land = 0 for ocean points. I want to use the land sea mask to eliminate ocean points from my temperature dataset df, i.e. I only want grid points in df where mf.land = 1.
And here's what mf looks like:

I'm trying this:
#import libraries
import os
import matplotlib.pyplot as plt
from netCDF4 import Dataset as netcdf_dataset
import numpy as np
from cartopy import config
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import xarray as xr
import pandas as pd
import netCDF4 as nc
#open temperature data and land sea mask
df=xr.open_dataset('/home/mmartin/LauNath/air.2m.2015.nc')
mf=xr.open_dataset('/home/mmartin/WinterMaxThesis/NOAAGrid/land.nc')
#apply mask
mask = (mf.land >= 1)
LandOnly=df.air.loc[mask]
But am having trouble because of the difference in dimensions. How can I mask out these ocean grid points?
