Python Client Library for accessing CMCC data
Project description
CMCC-DIAS-Client
DIAS API Client for access and analysis of CMCC data
Requirements
Python 3.7
Installation
Conda Installation
$ conda install -c ppos-cmcc diasapi
Pip installation
$ pip install diasapi
Cloning the repository
$ git clone https://github.com/CMCC-Foundation/cmcc-dias-client
$ cd cmcc-dias-client
$ python setup.py install
Configuration
To use the tool a file $HOME/.diasapirc
must be created as following
url: http://dias.cmcc.scc:8282/api/v1
key: <uid>:<api-key>
Examples
Query the catalog
import diasapi
c = diasapi.Client()
print(c.datasets())
Get details of a dataset
import diasapi
c = diasapi.Client()
print(c.datasets("blksea"))
Retrieve data
import diasapi
c = diasapi.Client()
c.retrieve("blksea",
{
'variable': ["votemper","vosaline"],
'product_type': "forecast-daily",
'year':2019,
'month':11,
'day': [20, 21],
'depth': [0, 30],
'delta_time': [36, 60],
'format': 'netcdf',
},
'_blksea_forecast_dtime.nc'
)
Retrieve data (area and resample)
import diasapi
c = diasapi.Client()
c.retrieve("era5",
{
'variable': "tp",
'product_type': "reanalysis",
'date_range': [2002, 2003],
'area': {'north': 47.2, 'south': 36.5, 'west': 6.5, 'east': 18.5},
'format': 'netcdf',
'resample':{
"operator": "sum",
"frequency": "1M",
"closed":"right"
}
},
'_era5_resampled.nc'
)
Retrieve data (location)
import diasapi
c = diasapi.Client()
c.retrieve("e-obs",
{
'variable': "rr",
'product_type': "obs-0.1",
'year': [2002, 2003],
'month': [10, 11],
'day': [1,2,3,31],
'location': [52.56, 8.45],
'format': 'netcdf',
},
'_eobs_location.nc'
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
diasapi-0.3a0.tar.gz
(8.6 kB
view hashes)
Built Distribution
diasapi-0.3a0-py3-none-any.whl
(12.4 kB
view hashes)