xanthos
xanthos copied to clipboard
Climate reader functionality
TASK:
Create a reader to ingest standard climate data formats in 3D [day, latitude, longitude] to the format and units required by Xanthos [land_cell, month].
COMPLETED:
- Built functionality to read in raw climate data commonly used and generated by ISIMIP
- Currently built functionality for
pr
,tas
,tasmin
,tasmax
- Test suite included
USAGE:
To save formatted outputs as datasets:
from xanthos import ClimateToXanthos
ctx = ClimateToXanthos(save_outputs=True)
# for precipitation ('pr')
pr_arr = ctx.format_pr(ncdf="<path to NetCDF file>",
data_variable_name='pr',
start_yr=<int four digit year>,
through_yr=<int four digit year>,
yr_interval=1,
out_file="<path and name to save NPY file to>")
# for `tas`
tas_arr = ctx.format_tas(ncdf="<path to NetCDF file>",
data_variable_name='tas',
out_file="<path and name to save NPY file to>")