ecmwf / ecmwf-api-client

Python API to access ECMWF archive
Apache License 2.0
67 stars 20 forks source link

Is it possible to have a spatial subset? #13

Closed FelipeSBarros closed 3 years ago

FelipeSBarros commented 3 years ago

Dear devs. Thanks for developing this API. I am working with CAMS NRT data and realized that in the web data retriever it is possible to get a spatial subset for both: already preset subset or considering a bounding box defined by user) like image below: image And this is the same for the spatial resolution: image

Is it possible to have any kind of spatial subset on using ecmwf-api? And about choosing the spatial resolution (grid size)?

Thanks in advance

cristian-codorean commented 3 years ago

Hi @FelipeSBarros, use a grid and / or area definition as in the example below:

#!/usr/bin/env python
from ecmwfapi import ECMWFDataServer
server = ECMWFDataServer()
server.retrieve({
    "class": "mc",
    "dataset": "cams_nrealtime",
    "date": "2021-02-01/to/2021-02-11",
    "expver": "0001",
    "levtype": "sfc",
    "param": "167.128",
    "step": "24",
    "stream": "oper",
    "time": "00:00:00",
    "type": "fc",
    "area": "73.5/-27/33/45", # Europe
    "grid": "0.4/0.4",
    "target": "output",
})

Some documentation on the format of grid and area at https://confluence.ecmwf.int/pages/viewpage.action?pageId=151520973.

FelipeSBarros commented 3 years ago

Thanks @cristian-codorean ! I have just found the FAQ web page. I was trying to find the documentation, but seems that everything I need to know is there. Thanks again!