Important information on CEMS Data Access via CDS

ECMWF has implemented a new state-of-the-art data access infrastructure to host the Climate and Atmospheric Data Stores (CDS and ADS, respectively). All layers of the infrastructure are being modernised: the front-end web interface, the back-end software engine, and the underlying cloud infrastructure hosting the service and core data repositories.

As part of this development, a new data store for the Copernicus Emergency Management Service (CEMS) has been created. The CEMS Early Warning Data Store (EWDS) will host all the historical and forecast information for floods and forest fires at European and Global levels. Users are encouraged to migrate their accounts and scripts to the new EWDS Beta before 26 September 2024, when the system will become operational.

For more information, Please read: CEMS Early Warning Data Store (EWDS) coming soon!


Warning

Updates to the EWDS documentation are ongoing as the implementation takes place. Scripts and examples on this page are under review and may not be fully functional yet for the EWDS, so please be patient.

Please send your feedback and/or report any issue/bug you may have encountered while using the new CDS/ADS/EWDS infrastructure by raising an enquiry ticket through our dedicated  Support Portal (ECMWF login required) - make sure you select "Yes" to the question Is this request related to CDS-beta/ADS-beta/CEMS-EW-beta? on the Support Portal request form - this will help the Support team with triaging enquiries more efficiently.

 

To convert a GRIB file, it is necessary to read it (see Open CEMS-Flood Data for more details)

Supposing you have downloded a GRIB file that you have named "download.grib", then it is possible to save it to disk converted into a NetCDF4 in the following way:

Reading and converting to NetCDF
import xarray as xr

ds = xr.open_dataset("download.grib", engine= "cfgrib")

ds.to_netcdf("download.nc")

You can use the Python executable below to perform the conversion from the terminal. Copy and paste the content of the code block below and save it in a python file called "grib_to_netcdf.py".

grib_to_netcdf.py
import xarray as xr
import argparse
import sys

def convert(input, output):

    try:
        ds = xr.open_dataset(
                        input,
                        engine='cfgrib',
                        backend_kwargs={'indexpath':''}
                        )

    except FileNotFoundError:
        sys.exit("File was not found : {}".format(input))

    ds.to_netcdf(output)


if __name__ == "__main__":

	parser = argparse.ArgumentParser(description='GRIB to NetCDF converter\n',
    		formatter_class=argparse.RawTextHelpFormatter)
	
    parser.add_argument('-i', dest='input', metavar='INPUT_FILE', required=True, help='INPUT_FILE')
	parser.add_argument('-o', dest='output', metavar='OUTPUT_FILE', required=True, help='OUTPUT_FILE')
	
	args = parser.parse_args()

	convert(args.input,args.output)

Run the executable with the input and output arguments:

user@host:/path/to/executable$ ./grib_to_netcdf.py -i donwload.grib -o download.nc