merra package

Submodules

merra.download module

The download module implements a command line script for downloading MERRA2 reanalysis data from the NASA GESDISC repository.

merra.download.folder_get_version_first_last(root, fmt='MERRA2_{stream}.tavg1_2d_lnd_Nx.{time:%Y%m%d}.nc4', subpaths=['{time:%Y}', '{time:%m}'])[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
  • subpaths (list, optional) – format of the subdirectories under root.
Returns:

  • version (string) – Found product version
  • start (datetime.datetime) – First found product datetime
  • end (datetime.datetime) – Last found product datetime

merra.download.get_first_folder(root, subpaths)[source]

Parameters:
  • root (string) –

  • subpaths (list of strings) –

Returns:

directory – …

Return type:

list of strings

merra.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.

Parameters:
  • folder (string) – path to folder
  • fmt – formatting rule
Returns:

first_elem – path to last directory

Return type:

string

merra.download.get_last_folder(root, subpaths)[source]

Parameters:
  • root (string) –

  • subpaths (list of strings) –

Returns:

directory – …

Return type:

list of strings

merra.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.

Parameters:
  • folder (string) – path to folder
  • fmt – formatting rule
Returns:

last_elem – path to last directory

Return type:

string

merra.download.get_start_date(product)[source]

Define start date of product version.

Parameters:product (string) – product specification
Returns:datetime – timestamp of start date
Return type:datetime.datetime
merra.download.main(args)[source]
merra.download.parse_args(args)[source]

Parse command line parameters for recursive download

Parameters:args (list of strings) – command line parameters
Returns:args – command line parameters
Return type:argparse.Namespace object
merra.download.run()[source]

merra.grid module

The grid module implements the asymmetrical GMAO 0.5 x 0.625 grid used in MERRA2 as a pygeogrids BasicGrid instance.

merra.grid.create_merra_cell_grid()[source]

Function creates the asymmetrical GMAO 0.5 x 0.625 grid as a BasicGrid instance.

Returns:
Return type:BasicGrid instance

merra.interface module

merra.reshuffle module

Module contents