# ERA-Interim how to select only grid-points over land area?

I am using ERA-Interim data, e.g. total precipitation, and I want to take only observations over land areas.

How can I filter the ERA-Interim dataset of precipitation to get only observations in grid-points over land?

Is there any specific method I should apply? Maybe CDO can help?

Thanks

The simplest way is to download another variable in which data is only available over the ocean, such as Sea Surface Temperature (SST). You should be able to download it in the very same way you do with precipitation (let us call it PREC hereafter).

Then, you can use any software that handles this type of data (Matlab, Python, NCL, GrADS...) to mask out the ocean cells. The logics is to assign a missing value (NaN) in PREC, where SST is not a missing value, to get the land-only PREC (PRECL). Or the other way around: keep the values of PREC where SST has missing values.

Imagine SST and PREC are 2D fields, that is, PREC=PREC(y,x) and SST=SST(y,x), where y and x are indices for latitude and longitude coordinates. In Python, the code should read something like the following, given that you have PREC, SST fields and the lat and lon arrays of coordinates as Numpy arrays.

import numpy as np

# Initialize variable with shape of PREC, filled with missing values:
PRECL = np.zeros(np.shape(PREC))
PRECL.fill(np.nan)

# Check the content of each cell in SST, to decide about PRECL:
for x in range(len(lon)):
for y in range(len(lat)):
if np.isnan(SST[y,x]):
PRECL[y,x] = PREC[y,x]
else:
PRECL[y,x] = np.nan


The land-sea mask for ERA Interim is available here.