ec-jrc / pyg2p Goto Github PK
View Code? Open in Web Editor NEWLicense: European Union Public License 1.2
License: European Union Public License 1.2
python3 branch setup.py fails with the error msg:
copying ./configuration/global/intertables.json -> build/bdist.linux-x86_64/egg/pyg2p/configuration/
copying ./configuration/global/parameters.json -> build/bdist.linux-x86_64/egg/pyg2p/configuration/
copying ./configuration/global/test.json -> build/bdist.linux-x86_64/egg/pyg2p/configuration/
error: can't copy './Docs/UserManual.pdf': doesn't exist or not a regular file
Application is fully documented but classes and methods lack of a minimal documentation (docstrings).
To check if Sphinx would be useful
Current version accepts only lat, lon and dem in PCRaster format.
Also check that when netcdf output format flag is set, there is no need of a PCRaster clonemap in configuration.
To reduce size of netcdf output files and improve read/write performance by using int format + offset.
https://github.com/ec-jrc/pyg2p/tree/20-py3
Tests on branch 20-py3 fails for COSMO files.
Results show correct values (identical to reference data) but with a different mask. Still no clue why it happens.
Actually, new results seem to be more appropriate/correct, as missing values in COSMO domain are correctly reported while in reference output, values outside COSMO domain are not MV (!).
See attached samples:
At ECMWF they need to interpolate precipitation and temperature from COSMO-LEPS gris files (one per member). At the moment, they are using the following hack in python:
def call_pyg2p(args):
print("Calling: pyg2p "+args)
return_code = subprocess.call("pyg2p "+args, shell=True)
if return_code:
raise RuntimeError("pyg2p returned code: "+str(return_code))
# interpolate precipitation from grib file
def read_precipitation(pyg2p_dir, meteo_dir, ens, tstart, tend):
template_file = pyg2p_dir+'/cos_r06_1km.json'
grib_file = meteo_dir+"/"+str(ens)+'.grb'
pyg2p_args = '--fmap 1 -c '+template_file+' -s '+str(tstart)+' -e '+str(tend)+' -m '+str(ens)+' -o '+str(ens)+'/ -l INFO -i '+grib_file
call_pyg2p(pyg2p_args)
# interpolate precipitation from grib file
def read_temperature(pyg2p_dir, meteo_dir, ens, tstart, tend):
template_file = pyg2p_dir+'/cos_t24_1km.json'
grib_file = meteo_dir+"/"+str(ens)+'.grb'
pyg2p_args = '--ext 1 --fmap 1 -c '+template_file+' -s '+str(tstart)+' -e '+str(tend)+' -m '+str(ens)+' -o '+str(ens)+'/ -l INFO -i '+grib_file
call_pyg2p(pyg2p_args)
And then read the resulting pcraster files. I would like to bypass the I/O and get directly the list of pcraster steps from pyg2p.
params = {
"name": "cosmo_r06", # optional, just for logging
"Aggregation": {
"forceZeroArray": true,
"step": 6,
"type": "accumulation"
},
"OutMaps": {
"cloneMap": "/dataset/maps/europe/dem.map",
"fmap": 1,
"namePrefix": "pR06",
"unitTime": 24,
"ext": 1,
"out_dir": "./test/",
"Interpolation": {
"latMap": "/dataset/maps/europe/lat.map",
"lonMap": "/dataset/maps/europe/lon.map",
"mode": "nearest"
}
},
"Parameter": {
"applyConversion": "k2c",
"correctionFormula": "p+gem-dem*0.0065",
"demMap": "/dataset/maps/europe/dem.map",
"gem": "(z/9.81)*0.0065",
"shortName": "2t"
}
}
interpolated_precipitation = pyg2p.call(grib_file, params)
Result can be (to decide)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.