Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleCDS API example of regional subselection and interpolation


Code Block
languagepy
import cdsapi

c = cdsapi.Client()

c.retrieve(
    'seasonal-monthly-single-levels',
    {
        'format':'grib',
        'originating_centre':'cmcc',
        'system':'3',
        'variable':'2m_temperature',
        'product_type':'monthly_mean',
        'year':'2007',
        'month':'11',
        'leadtime_month':['1','2','3','4','5','6'],
		'area' : '75/-25/10/60', # 'North/West/South/East' (i.e. 'top-left corner lat/top-left corner lon/bottom-right corner lat/bottom-right corner lon'
		'grid' : '2.5/2.5' # Interpolate to a regular 2.5x2.5 degree horizontal grid
    },
    'download.grib')

More details about the syntax of area and grid in MARS/WebAPI can be found here.

Users must be aware of the following:

    • Use of area for regional subselection is safe.
    • Use of grid for horizontal interpolation is currently NOT recommended:
      • It can lead to errors when trying to download MetOffice data. More information about what causes this error can be found in Known issue D2.
      • It can lead to failing data retrievals if more than one model version (system) is requested. Note that if system is not explicitly specified it defaults to all available systems.
      • Data previously downloaded using Web API may have used a different interpolation method; you would need to assess whether such differences are relevant for your choice of data. This issue is relevant in the context of the required consistency between interpolation of real-time forecasts and the associated hindcasts.

...