Configuration Object

class GridContext(subclass=None, doc=None)[source]

Defines a configuration object to process aggregations and other tasks over data grids

Constructor

Parameters:

doc – Optional argument, specifying what to print as documentation

classmethod enum(enum_cls, s: str)

A helper method to return Enum value by its name

Parameters:
  • cls – Enum class

  • s – name of a member in Enum class

Returns:

value of the member

years

Year or list of years to download. For example, the following argument: -y 1992:1995 1998 1999 2011 2015:2017 will produce the following list: [1992,1993,1994,1995,1998,1999,2011,2015,2016,2017]

compress

Specifies whether to use gzip compression for the result

variables

Gridmet bands or variables

Type:

List[GridmetVariable]

strategy

Rasterization strategy :type: RasterizationStrategy

destination

Destination directory for the processed files

raw_downloads

Directory for downloaded raw files

geography

The type of geographic area over which we aggregate data

Type:

Geography

shapes_dir

Directory containing shape files for geographies

shapes

Type of shapes to aggregate over, e.g. points, polygons

Type:

List[Shape]

points

Path to CSV file containing points

coordinates

Column names for coordinates

metadata

Column names for metadata

extra_columns

Columns with constant values to be added to the output file

dates: Optional[DateFilter]

Filter on dates - for debugging purposes only

statistics

Type of statistics

description

Description to be added to data dictionary

table

Name of the table where the aggregated data will be stored

output

Type of the output the tool should produce

ram

Runtime memory available to the process

class GridMETContext(doc=None)[source]

Defines a configuration object to process aggregations and other tasks over data grids containing gridMET data. Includes validation that a correct gridMET band is provided

Constructor

Parameters:

doc – Optional argument, specifying what to print as documentation

classmethod enum(enum_cls, s: str)

A helper method to return Enum value by its name

Parameters:
  • cls – Enum class

  • s – name of a member in Enum class

Returns:

value of the member

dates: Optional[DateFilter]

Filter on dates - for debugging purposes only

variables

Gridmet bands or variables

Type:

List[GridmetVariable]

strategy

Rasterization strategy :type: RasterizationStrategy

destination

Destination directory for the processed files

raw_downloads

Directory for downloaded raw files

geography

The type of geographic area over which we aggregate data

Type:

Geography

shapes_dir

Directory containing shape files for geographies

shapes

Type of shapes to aggregate over, e.g. points, polygons

Type:

List[Shape]

points

Path to CSV file containing points

coordinates

Column names for coordinates

metadata

Column names for metadata

extra_columns

Columns with constant values to be added to the output file

statistics

Type of statistics

description

Description to be added to data dictionary

table

Name of the table where the aggregated data will be stored

output

Type of the output the tool should produce

ram

Runtime memory available to the process

years

Year or list of years to download. For example, the following argument: -y 1992:1995 1998 1999 2011 2015:2017 will produce the following list: [1992,1993,1994,1995,1998,1999,2011,2015,2016,2017]

compress

Specifies whether to use gzip compression for the result

Classes used Internally

Abstract Context

class Context(subclass, description=None, include_default: bool = True)[source]

Generic class allowing to build context and configuration objects and initialize them using command line arguments

Creates a new object

Parameters:
  • subclass – A concrete class containing configuration information Configuration options must be defined as class memebers with names, starting with one ‘_’ characters and values be instances of :class Argument:

  • description – Optional text to use as description. If not specified, then it is extracted from subclass documentation

years

Year or list of years to download. For example, the following argument: -y 1992:1995 1998 1999 2011 2015:2017 will produce the following list: [1992,1993,1994,1995,1998,1999,2011,2015,2016,2017]

compress

Specifies whether to use gzip compression for the result

validate(attr, value)[source]

Subclasses can override this method to implement custom handling of command line arguments

Parameters:
  • attr – Command line argument name

  • value – Value returned by argparse

Returns:

value to use

classmethod enum(enum_cls, s: str)[source]

A helper method to return Enum value by its name

Parameters:
  • cls – Enum class

  • s – name of a member in Enum class

Returns:

value of the member

Argument

class Argument(name, help: str, type=<class 'str'>, aliases: ~typing.Optional[~typing.List] = None, default=None, cardinality: ~dorieh.utils.context.Cardinality = Cardinality.single, valid_values=None, required=True)[source]

A wrapper class to describe a command-line arguments This is practically, a more rigid format for :func ArgumentParser.add_argument:

All arguments are passed to Argparser

Parameters:
  • name

  • help

  • type

  • aliases

  • default

  • cardinality

  • valid_values

Argument Cardinality Enum

class Cardinality(value)[source]

Cardinality of a configuration parameter: multiple or singular