<p>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).</p>

<p>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 <em>not</em> 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.</p>

<p>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 <code>PREC</code>, <code>SST</code> fields and the <code>lat</code> and <code>lon</code> arrays of coordinates as Numpy arrays.</p>



<pre><code>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
</code></pre>

CC BY-SA 4.0
2019-05-07T13:33:23.473Z
2019-05-07T14:01:45.137Z
2019-05-07T14:01:45.137Z
ouranos
<p>The land-sea mask for ERA Interim is available <a href="https://apps.ecmwf.int/datasets/data/interim-full-invariant/" rel="nofollow noreferrer">here</a>.</p>

CC BY-SA 4.0
2019-05-07T16:23:01.087Z
2019-05-07T16:23:01.087Z
Basileios
<p>I am using ERA-Interim data, e.g. total precipitation, and I want to take only observations over land areas.</p>

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

<p>Is there any specific method I should apply?
Maybe CDO can help?</p>

<p>Thanks </p>

<reanalysis><era><grid-spacing>
ERA-Interim how to select only grid-points over land area?
aaaaa
# ERA-Interim how to select only grid-points over land area?

(Asked by: username_0 on 2019-05-05)

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

**Tags:** reanalysis, era, grid-spacing


---

## 2 answers

### Answer by username_1 on 2019-05-07. Score: 2

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

```


---

### Answer by username_2 on 2019-05-07. Score: 1

The land-sea mask for ERA Interim is available [here](https://apps.ecmwf.int/datasets/data/interim-full-invariant/).


---

