-
Notifications
You must be signed in to change notification settings - Fork 6
easy_export
Exporting a xarray.Dataset or xarray.DataArray as netcdf or geotiff is not complicated, but requires several preparation steps which can differ depending on the type of xarray to export.
The function easy_export__ tries to offer a one fit all solution. The user just need to call the function with the following three arguments to get netcdf or geotiff files (one per time in the xarray):
- data: xarray.Dataset or xarray.DataArray to be exported
- prfx: prefix to be used to name the exported file(s)
- ncortif: either nc(netcdf) or tif (geotiff)
As exporting xarray.Dataset can create complexe files (3 bands red, green and blue in the figure below) each of them containing "time" sub-bands (3 time period in the figure below). The easy_export function creates one file per time period and add the date and time in the filename.
Geotiff are easier to load on QGIS (as netcdf loose CRS information and each bands need to be manually selected)
If you have credentials for the Swiss Data Cube, you can play with a demo script at http://sdc.unepgrid.ch:8080/notebooks/demo_FUN_easy_export.ipynb
The code and the demo jupyter notebook script can be found here