JGCRI / xanthos

An extensible global hydrologic framework
Other
32 stars 16 forks source link

Climate reader functionality #47

Open crvernon opened 5 years ago

crvernon commented 5 years ago

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:

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>")
rplzzz commented 4 years ago

@crvernon It looks like you still have me marked as a reviewer on this PR. I'm guessing this is an oversight, though I'm happy to give you my thoughts if you want them.