Unable to restric area on 'satellite-land-cover' download

Hi,
I am trying to download land cover data using the API and I want to download a restricted area using 4 coordinates (North West South East). The request is sent and the data is downloaded but I always download the whole dataset which is quite large (3Gb). This is the code i am using:

import cdsapi
c = cdsapi.Client()
c.retrieve(
	'satellite-land-cover',
	{
		'variable': 'all',
		'year': '2014',
		'version': 'v2.0.7cds',
		'area': [-18, 100, -30, 120],
        'grid': [0.4,0.4],
		'format': 'zip',
	}, 
	'download.zip')

Thank you in advance for the help given,
Hippolyte

Static datasets don’t have the feature to ‘sub-set’ the data as this requires a different method for storage and provisioning through the archive.

This means that this dataset doesn’t have the feature to select the area, so you’ll have to download the whole region every time.

You can often recognize this if the file format is ‘zip’, those are the more static datasets.

For subsetting the data you could use CDO (see: Overview - CDO - Project Management Service ), with the following command (West,East,South,North):
cdo sellonlatbox,100,120,-30,-18 .\download.nc[.grib] .\outfile.nc[.grib]

Or when using python (with xarray):

import xarray as xr

ds = xr.open_dataset(download.nc, engine='netcdf4')
cropped_ds = ds.sel(lat=slice(-30,-18), lon=slice(100,120))

Python packages needed: xarray, netcdf4, dask, scipy

Hi,
a dataset can be subset when the area widget is available on the dataset download webform.

Thanks

1 Like