gldas package¶
Submodules¶
gldas.download module¶
Module managing download of NOAH GLDAS data.
- gldas.download.get_first_formatted_dir_in_dir(folder, fmt)[source]¶
Get the (alphabetically) first directory in a directory which can be formatted according to fmt.
- gldas.download.get_gldas_start_date(product)[source]¶
Get NOAH GLDAS start date.
- Parameters
product (str) – Product name.
- Returns
start_date – Start date of NOAH GLDAS product.
- Return type
datetime
- gldas.download.get_last_formatted_dir_in_dir(folder, fmt)[source]¶
Get the (alphabetically) last directory in a directory which can be formatted according to fmt.
- gldas.download.gldas_folder_get_version_first_last(root, fmt=None, subpaths=['{time:%Y}', '{time:%j}'])[source]¶
Get product version and first and last product which exists under the root folder.
- Parameters
root (string) – Root folder on local filesystem
fmt (string, optional) – Formatting string (default: “GLDAS_NOAH025_3H.A{time:%Y%m%d.%H%M}.0{version:2s}.nc4”)
subpaths (list, optional) – Format of the subdirectories under root (default: [‘{:%Y}’, ‘{:%j}’]).
- Returns
version (string) – Found product version
start (datetime.datetime) – First found product datetime
end (datetime.datetime) – Last found product datetime
- gldas.download.main(args)[source]¶
Main routine used for command line interface.
- Parameters
args (list of str) – Command line arguments.
gldas.grid module¶
- gldas.grid.GLDAS025Cellgrid()[source]¶
Alias to create a global 0.25 DEG grid without gaps w. 5 DEG cells
- gldas.grid.GLDAS025Grids(only_land=False)[source]¶
Create global 0.25 DEG gldas grids (origin in bottom left)
- Parameters
only_land (bool, optional (default: False)) – Uses the land mask to reduce the GLDAS 0.25DEG land grid to land points only.
- Returns
grid – Either a land grid or a global grid
- Return type
pygeogrids.CellGrid
- gldas.grid.GLDAS025LandGrid()[source]¶
Alias to create a global 0.25 DEG grid over land only w. 5 DEG cells
gldas.interface module¶
- class gldas.interface.GLDASTs(ts_path, grid_path=None, **kwargs)[source]¶
Bases:
GriddedNcOrthoMultiTs
- class gldas.interface.GLDAS_Noah_v1_025Ds(data_path, parameter='086_L1', subgrid=None, array_1D=False)[source]¶
Bases:
MultiTemporalImageBase
Class for reading GLDAS images in grib format.
- Parameters
data_path (string) – path to the grib files
parameter (string or list, optional) –
- one or list of [‘001’, ‘011’, ‘032’, ‘051’, ‘057’, ‘065’, ‘071’,
’085_L1’, ‘085_L2’, ‘085_L3’, ‘085_L4’, ‘086_L1’, ‘086_L2’, ‘086_L3’, ‘086_L4’, ‘099’, ‘111’, ‘112’, ‘121’, ‘122’, ‘131’, ‘132’, ‘138’, ‘155’, ‘204’, ‘205’, ‘234’, ‘235’]
parameters to read, see GLDAS documentation for more information Default : ‘086_L1’
subgrid (Cell Grid) – Subgrid of the global GLDAS Grid to use for reading image data (e.g only land points)
array_1D (boolean, optional) – if set then the data is read into 1D arrays. Needed for some legacy code.
- class gldas.interface.GLDAS_Noah_v1_025Img(filename, mode='r', parameter='086_L1', subgrid=None, array_1D=False)[source]¶
Bases:
ImageBase
Class for reading one GLDAS Noah v1 grib file in 0.25 deg grid.
- Parameters
filename (string) – filename of the GLDAS grib file
mode (string, optional) – mode of opening the file, only ‘r’ is implemented at the moment
parameter (string or list, optional) –
- one or list of [‘001’, ‘011’, ‘032’, ‘051’, ‘057’, ‘065’, ‘071’,
’085_L1’, ‘085_L2’, ‘085_L3’, ‘085_L4’, ‘086_L1’, ‘086_L2’, ‘086_L3’, ‘086_L4’, ‘099’, ‘111’, ‘112’, ‘121’, ‘122’, ‘131’, ‘132’, ‘138’, ‘155’, ‘204’, ‘205’, ‘234’, ‘235’]
parameters to read, see GLDAS documentation for more information Default : ‘086_L1’
subgrid (Cell Grid) – Subgrid of the global GLDAS Grid to use for reading image data (e.g only land points)
array_1D (boolean, optional) – if set then the data is read into 1D arrays. Needed for some legacy code.
- class gldas.interface.GLDAS_Noah_v21_025Ds(data_path, parameter='SoilMoi0_10cm_inst', subgrid=None, array_1D=False)[source]¶
Bases:
MultiTemporalImageBase
Class for reading GLDAS v2.1 images in nc format.
- Parameters
data_path (string) – Path to the nc files
parameter (string or list, optional) – one or list of parameters to read, see GLDAS v2.1 documentation for more information (default: ‘SoilMoi0_10cm_inst’).
subgrid (Cell Grid) – Subgrid of the global GLDAS Grid to use for reading image data (e.g only land points)
array_1D (boolean, optional) – If set then the data is read into 1D arrays. Needed for some legacy code.
- class gldas.interface.GLDAS_Noah_v21_025Img(filename, mode='r', parameter='SoilMoi0_10cm_inst', subgrid=None, array_1D=False)[source]¶
Bases:
GLDAS_Noah_v2_025Img
- class gldas.interface.GLDAS_Noah_v2_025Img(filename, mode='r', parameter='SoilMoi0_10cm_inst', subgrid=None, array_1D=False)[source]¶
Bases:
ImageBase
Class for reading one GLDAS Noah v2.1 nc file in 0.25 deg grid.
gldas.reshuffle module¶
Module for a command line interface to convert the GLDAS data into a time series format using the repurpose package
- gldas.reshuffle.get_filetype(inpath)[source]¶
Tries to find out the file type by searching for grib or nc files two subdirectories into the passed input path. If function fails, netcdf is assumed.
- gldas.reshuffle.main(args)[source]¶
Main routine used for command line interface.
- Parameters
args (list of str) – Command line arguments.
- gldas.reshuffle.mkdate(datestring)[source]¶
Create date string.
- Parameters
datestring (str) – Date string.
- Returns
datestr – Date string as datetime.
- Return type
datetime
- gldas.reshuffle.parse_args(args)[source]¶
Parse command line parameters for recursive download.
- Parameters
args (list of str) – Command line parameters as list of strings.
- Returns
args – Command line arguments.
- Return type
- gldas.reshuffle.reshuffle(input_root, outputpath, startdate, enddate, parameters, input_grid=None, imgbuffer=50)[source]¶
Reshuffle method applied to GLDAS data.
- Parameters
input_root (string) – input path where gldas data was downloaded
outputpath (string) – Output path.
startdate (datetime) – Start date.
enddate (datetime) – End date.
parameters (list) – parameters to read and convert
input_grid (CellGrid, optional (default: None)) – Local input grid to read data for. If None is passed, we create the grid from data.
imgbuffer (int, optional) – How many images to read at once before writing time series.
gldas.utils module¶
- gldas.utils.deprecated(message: Optional[str] = None)[source]¶
Decorator for classes or functions to mark them as deprecated. If the decorator is applied without a specific message (@deprecated()), the default warning is shown when using the function/class. To specify a custom message use it like:
@deprecated(‘Don’t use this function anymore!’).
- Parameters
message (str, optional (default: None)) – Custom message to show with the DeprecationWarning.