Command Line¶
Help:
mettoolbox --help
about¶
$ mettoolbox about --help
usage: mettoolbox about [-h]
Display version number and system information.
options:
-h, --help show this help message and exit
disaggregate¶
$ mettoolbox disaggregate --help
usage: mettoolbox disaggregate [-h]
{evaporation,humidity,dewpoint_temperature,precipitation,radiation,temperature,wind_speed}
...
positional arguments:
{evaporation,humidity,dewpoint_temperature,precipitation,radiation,temperature,wind_speed}
evaporation Disaggregate daily evaporation to hourly evaporation.
humidity Disaggregate daily relative humidity to hourly
humidity.
dewpoint_temperature
Disaggregate daily relative humidity to hourly dew
point.
precipitation Disaggregate daily precipitation to hourly
precipitation.
radiation Disaggregate daily radiation to hourly radiation.
temperature Disaggregate daily temperature to hourly temperature.
wind_speed Disaggregate daily wind speed to hourly wind speed.
options:
-h, --help show this help message and exit
disaggregate dewpoint_temperature¶
$ mettoolbox disaggregate dewpoint_temperature --help
usage: mettoolbox disaggregate dewpoint_temperature [-h] [--input_ts INPUT_TS]
[--columns COLUMNS] [--start_date START_DATE] [--end_date END_DATE] [--dropna
DROPNA] [--clean] [--round_index ROUND_INDEX] [--skiprows SKIPROWS]
[--index_type INDEX_TYPE] [--names NAMES] [--target_units TARGET_UNITS]
[--print_input] [--tablefmt TABLEFMT] [--precip_col PRECIP_COL]
[--temp_min_col TEMP_MIN_COL] [--temp_max_col TEMP_MAX_COL] [--hum_min_col
HUM_MIN_COL] [--hum_max_col HUM_MAX_COL] [--hum_mean_col HUM_MEAN_COL] [--a0
A0] [--a1 A1] [--kr KR] [--hourly_temp HOURLY_TEMP] [--hourly_precip_hum
HOURLY_PRECIP_HUM] [--preserve_daily_mean PRESERVE_DAILY_MEAN] method
source_units
Dewpoint disaggregation requires the following input data.
┌──────────────┬─────────────────────────────────────────────────────────┐
│ Input data │ Description │
╞══════════════╪═════════════════════════════════════════════════════════╡
│ hum_min_col │ Required column name or number representing the minimum │
│ │ daily relative humidity. │
├──────────────┼─────────────────────────────────────────────────────────┤
│ hum_max_col │ Required column name or number representing the maximum │
│ │ daily relative humidity. │
├──────────────┼─────────────────────────────────────────────────────────┤
│ hum_mean_col │ Optional column name or number representing the average │
│ │ daily relative humidity. Default is None and if None │
│ │ will be calculated as average of hum_min_col and │
├──────────────┼─hum_max_col.────────────────────────────────────────────┤
│ temp_min_col │ Required column name or number representing the minimum │
│ │ daily temperature for minimal, dewpoint regression, │
│ │ linear dewpoint variation, and min_max methods. │
├──────────────┼─────────────────────────────────────────────────────────┤
│ temp_max_col │ Required column name or number representing the maximum │
│ │ daily temperature for min_max method. │
├──────────────┼─────────────────────────────────────────────────────────┤
│ precip_col │ Required column name or number representing the total │
│ │ precipitation for month_hour_precip_mean method. │
╘══════════════╧═════════════════════════════════════════════════════════╛
positional arguments:
method Available disaggregation methods for
humidity.
┌───────────────────────────┬────────────────────────────────────────┐
│ method │ Description │
╞═══════════════════════════╪════════════════════════════════════════╡
│ equal │ Duplicate mean daily humidity for the │
│ │ 24 hours of the day. │
├───────────────────────────┼────────────────────────────────────────┤
│ minimal │ The dew point temperature is set to │
│ │ the minimum temperature on that day. │
├───────────────────────────┼────────────────────────────────────────┤
│ dewpoint_regression │ Using hourly observations, a │
│ │ regression approach is applied to │
│ │ calculate daily dew point temperature. │
│ │ Regression parameters must be │
├───────────────────────────┼─specified.─────────────────────────────┤
│ linear_dewpoint_variation │ This method extends through linearly │
│ │ varying dew point temperature between │
│ │ consecutive days. The parameter kr │
│ │ needs to be specified (kr=6 if monthly │
│ │ radiation exceeds 100 W/m2 else │
├───────────────────────────┼─kr=12).────────────────────────────────┤
│ min_max │ This method requires minimum and │
│ │ maximum relative humidity for each │
├───────────────────────────┼─day.───────────────────────────────────┤
│ month_hour_precip_mean │ Calculate hourly humidity from │
│ │ categorical [month, hour, precip(y/n)] │
│ │ mean values derived from observations. │
╘═══════════════════════════╧════════════════════════════════════════╛
Required keywords for each method. The "Column Name/Index Keywords"
represent the column name or index (data columns starting numbering at
1) in the input dataset.
┌───────────────────────────┬────────────────┬───────────────┐
│ method │ Column Name/ │ Other Keywor- │
│ │ Index Keywords │ ds │
╞═══════════════════════════╪════════════════╪═══════════════╡
│ equal │ hum_mean_col │ hourly_temp │
├───────────────────────────┼────────────────┼───────────────┤
│ minimal │ temp_min_col │ │
├───────────────────────────┼────────────────┼───────────────┤
│ dewpoint_regression │ temp_min_col │ a0 a1 hourly- │
│ │ │ _temp │
├───────────────────────────┼────────────────┼───────────────┤
│ linear_dewpoint_variation │ temp_min_col │ a0 a1 kr │
│ │ │ hourly_temp │
├───────────────────────────┼────────────────┼───────────────┤
│ min_max │ hum_min_col │ hourly_temp │
│ │ hum_max_col │ │
│ │ temp_min_col │ │
│ │ temp_max_col │ │
├───────────────────────────┼────────────────┼───────────────┤
│ month_hour_precip_mean │ precip_col │ │
╘═══════════════════════════╧════════════════╧═══════════════╛
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
options:
-h | --help
show this help message and exit
--input_ts INPUT_TS
[optional though required if using within Python, default is '-' (stdin)]
Whether from a file or standard input, data requires a single line header
of column names. The default header is the first line of the input,
but this can be changed for CSV files using the 'skiprows' option.
Most common date formats can be used, but the closer to ISO 8601 date/time
standard the better.
Comma-separated values (CSV) files or tab-separated values (TSV):
File separators will be automatically detected.
Columns can be selected by name or index, where the index for
data columns starts at 1.
Command line examples:
┌─────────────────────────────────┬───────────────────────────┐
│ Keyword Example │ Description │
╞═════════════════════════════════╪═══════════════════════════╡
│ --input_ts=fn.csv │ read all columns from │
│ │ 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,1 │ read data columns 2 and 1 │
│ │ from 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,skiprows=2 │ read data column 2 from │
│ │ 'fn.csv', skipping first │
│ │ 2 rows so header is read │
│ │ from third row │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.xlsx,2,Sheet21 │ read all data from 2nd │
│ │ sheet all data from │
│ │ "Sheet21" of 'fn.xlsx' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.hdf5,Table12,T2 │ read all data from table │
│ │ "Table12" then all data │
│ │ from table "T2" of │
│ │ 'fn.hdf5' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.wdm,210,110 │ read DSNs 210, then 110 │
│ │ from 'fn.wdm' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' │ read all columns from │
│ │ standard input (stdin) │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' --columns=4,1 │ read column 4 and 1 from │
│ │ standard input (stdin) │
╘═════════════════════════════════╧═══════════════════════════╛
If working with CSV or TSV files you can use redirection rather than use
--input_ts=fname.csv. The following are identical:
From a file:
command subcmd --input_ts=fname.csv
From standard input (since '--input_ts=-' is the default:
command subcmd < fname.csv
Can also combine commands by piping:
command subcmd < filein.csv | command subcmd1 > fileout.csv
Python library examples:
You must use the `input_ts=...` option where `input_ts` can be
one of a [pandas DataFrame, pandas Series, dict, tuple, list,
StringIO, or file name].
--columns COLUMNS
[optional, defaults to all columns, input filter]
Columns to select out of input. Can use column names from the first line
header or column numbers. If using numbers, column number 1 is the
first data column. To pick multiple columns; separate by commas with
no spaces. As used in toolbox_utils pick command.
This solves a big problem so that you don't have to create a data set with
a certain column order, you can rearrange columns when data is read
in.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
--precip_col PRECIP_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily precipitation.
--temp_min_col TEMP_MIN_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily minimum temperature.
--temp_max_col TEMP_MAX_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily maximum temperature.
--hum_min_col HUM_MIN_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily minimum humidity.
--hum_max_col HUM_MAX_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily maximum humidity.
--hum_mean_col HUM_MEAN_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily maximum humidity.
--a0 A0
The "a0" parameter.
--a1 A1
The "a1" parameter.
--kr KR
Parameter for the "linear_dewpoint_variation" method.
--hourly_temp HOURLY_TEMP
Filename of a CSV file that contains an hourly time series of
temperatures.
--hourly_precip_hum HOURLY_PRECIP_HUM
Filename of a CSV file that contains an hourly time series of
precipitation and humidity.
--preserve_daily_mean PRESERVE_DAILY_MEAN
Column name or index (data columns start at 1) that identifies the
observed daily mean humidity. If not None will correct the daily
mean values of the disaggregated data with the observed daily mean
humidity.
disaggregate evaporation¶
$ mettoolbox disaggregate evaporation --help
<string>:24: (WARNING/2) Definition list ends without a blank line; unexpected unindent.
usage: mettoolbox disaggregate evaporation [-h] [--input_ts INPUT_TS]
[--columns COLUMNS] [--start_date START_DATE] [--end_date END_DATE] [--dropna
DROPNA] [--clean] [--round_index ROUND_INDEX] [--skiprows SKIPROWS]
[--index_type INDEX_TYPE] [--names NAMES] [--target_units TARGET_UNITS]
[--print_input] [--tablefmt TABLEFMT] [--lat LAT] method source_units
Disaggregate daily evaporation to hourly evaporation.
positional arguments:
method This is the method that will be used to disaggregate
the daily evaporation data.
There are two methods, a trapezoidal shape from sunrise to sunset called
"trap" and a fixed, smooth curve starting at 0700 (7 am) and stopping at
1900 (7 pm) called "fixed".
Definition list ends without a blank line; unexpected unindent.
source_units [optional, default is None, transformation]
If unit is specified for the column as the second field of a ':' delimited
column name, then the specified units and the 'source_units' must match
exactly.
Any unit string compatible with the 'pint' library can be used.
options:
-h | --help
show this help message and exit
--input_ts INPUT_TS
[optional though required if using within Python, default is '-' (stdin)]
Whether from a file or standard input, data requires a single line header
of column names. The default header is the first line of the input,
but this can be changed for CSV files using the 'skiprows' option.
Most common date formats can be used, but the closer to ISO 8601 date/time
standard the better.
Comma-separated values (CSV) files or tab-separated values (TSV):
File separators will be automatically detected.
Columns can be selected by name or index, where the index for
data columns starts at 1.
Command line examples:
┌─────────────────────────────────┬───────────────────────────┐
│ Keyword Example │ Description │
╞═════════════════════════════════╪═══════════════════════════╡
│ --input_ts=fn.csv │ read all columns from │
│ │ 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,1 │ read data columns 2 and 1 │
│ │ from 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,skiprows=2 │ read data column 2 from │
│ │ 'fn.csv', skipping first │
│ │ 2 rows so header is read │
│ │ from third row │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.xlsx,2,Sheet21 │ read all data from 2nd │
│ │ sheet all data from │
│ │ "Sheet21" of 'fn.xlsx' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.hdf5,Table12,T2 │ read all data from table │
│ │ "Table12" then all data │
│ │ from table "T2" of │
│ │ 'fn.hdf5' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.wdm,210,110 │ read DSNs 210, then 110 │
│ │ from 'fn.wdm' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' │ read all columns from │
│ │ standard input (stdin) │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' --columns=4,1 │ read column 4 and 1 from │
│ │ standard input (stdin) │
╘═════════════════════════════════╧═══════════════════════════╛
If working with CSV or TSV files you can use redirection rather than use
--input_ts=fname.csv. The following are identical:
From a file:
command subcmd --input_ts=fname.csv
From standard input (since '--input_ts=-' is the default:
command subcmd < fname.csv
Can also combine commands by piping:
command subcmd < filein.csv | command subcmd1 > fileout.csv
Python library examples:
You must use the `input_ts=...` option where `input_ts` can be
one of a [pandas DataFrame, pandas Series, dict, tuple, list,
StringIO, or file name].
--columns COLUMNS
[optional, defaults to all columns, input filter]
Columns to select out of input. Can use column names from the first line
header or column numbers. If using numbers, column number 1 is the
first data column. To pick multiple columns; separate by commas with
no spaces. As used in toolbox_utils pick command.
This solves a big problem so that you don't have to create a data set with
a certain column order, you can rearrange columns when data is read
in.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
--lat LAT
The latitude of the station. Positive specifies the Northern Hemisphere,
and negative values represent the Southern Hemisphere.
disaggregate humidity¶
$ mettoolbox disaggregate humidity --help
usage: mettoolbox disaggregate humidity [-h] [--input_ts INPUT_TS]
[--columns COLUMNS] [--start_date START_DATE] [--end_date END_DATE] [--dropna
DROPNA] [--clean] [--round_index ROUND_INDEX] [--skiprows SKIPROWS]
[--index_type INDEX_TYPE] [--names NAMES] [--target_units TARGET_UNITS]
[--print_input] [--tablefmt TABLEFMT] [--precip_col PRECIP_COL]
[--temp_min_col TEMP_MIN_COL] [--temp_max_col TEMP_MAX_COL] [--hum_min_col
HUM_MIN_COL] [--hum_max_col HUM_MAX_COL] [--hum_mean_col HUM_MEAN_COL] [--a0
A0] [--a1 A1] [--kr KR] [--hourly_temp HOURLY_TEMP] [--hourly_precip_hum
HOURLY_PRECIP_HUM] [--preserve_daily_mean PRESERVE_DAILY_MEAN] method
source_units
Relative humidity disaggregation requires the following input data.
┌──────────────┬──────────────────────────────────────────────────────────┐
│ Input data │ Description │
╞══════════════╪══════════════════════════════════════════════════════════╡
│ hum_min_col │ Required column name or number representing the minimum │
│ │ daily relative humidity. │
├──────────────┼──────────────────────────────────────────────────────────┤
│ hum_max_col │ Required column name or number representing the maximum │
│ │ daily relative humidity. │
├──────────────┼──────────────────────────────────────────────────────────┤
│ hum_mean_col │ Optional column name or number representing the average │
│ │ daily relative humidity. Default is None and if None │
│ │ will be calculated as average of hum_min_col and │
├──────────────┼─hum_max_col.─────────────────────────────────────────────┤
│ temp_min_col │ Required column name or number representing the minimum │
│ │ daily temperature for minimal, dewpoint regression, │
│ │ linear dewpoint variation, and min_max methods. │
├──────────────┼──────────────────────────────────────────────────────────┤
│ temp_max_col │ Required column name or number representing the maximum │
│ │ daily temperature for min_max method. │
├──────────────┼──────────────────────────────────────────────────────────┤
│ precip_col │ Required column name or number representing the total │
│ │ precipitation for month_hour_precip_mean method. │
╘══════════════╧══════════════════════════════════════════════════════════╛
positional arguments:
method Available disaggregation methods for
humidity.
┌───────────────────────────┬────────────────────────────────────────┐
│ method │ Description │
╞═══════════════════════════╪════════════════════════════════════════╡
│ equal │ Duplicate mean daily humidity for the │
│ │ 24 hours of the day. │
├───────────────────────────┼────────────────────────────────────────┤
│ minimal │ The dew point temperature is set to │
│ │ the minimum temperature on that day. │
├───────────────────────────┼────────────────────────────────────────┤
│ dewpoint_regression │ Using hourly observations, a │
│ │ regression approach is applied to │
│ │ calculate daily dew point temperature. │
│ │ Regression parameters must be │
├───────────────────────────┼─specified.─────────────────────────────┤
│ linear_dewpoint_variation │ This method extends through linearly │
│ │ varying dew point temperature between │
│ │ consecutive days. The parameter kr │
│ │ needs to be specified (kr=6 if monthly │
│ │ radiation exceeds 100 W/m2 else │
├───────────────────────────┼─kr=12).────────────────────────────────┤
│ min_max │ This method requires minimum and │
│ │ maximum relative humidity for each │
├───────────────────────────┼─day.───────────────────────────────────┤
│ month_hour_precip_mean │ Calculate hourly humidity from │
│ │ categorical [month, hour, precip(y/n)] │
│ │ mean values derived from observations. │
╘═══════════════════════════╧════════════════════════════════════════╛
Required keywords for each method. The "Column Name/Index Keywords"
represent the column name or index (data columns starting numbering at
1) in the input dataset.
┌───────────────────────────┬────────────────┬───────────────┐
│ method │ Column Name/ │ Other Keywor- │
│ │ Index Keywords │ ds │
├───────────────────────────┼────────────────┼───────────────┤
│ equal │ hum_mean_col │ │
├───────────────────────────┼────────────────┼───────────────┤
│ minimal │ temp_min_col │ hourly_temp │
├───────────────────────────┼────────────────┼───────────────┤
│ dewpoint_regression │ temp_min_col │ a0 a1 hourly- │
│ │ │ _temp │
├───────────────────────────┼────────────────┼───────────────┤
│ linear_dewpoint_variation │ temp_min_col │ a0 a1 kr │
│ │ │ hourly_temp │
├───────────────────────────┼────────────────┼───────────────┤
│ min_max │ hum_min_col │ hourly_temp │
│ │ hum_max_col │ │
│ │ temp_min_col │ │
│ │ temp_max_col │ │
├───────────────────────────┼────────────────┼───────────────┤
│ month_hour_precip_mean │ precip_col │ │
╘═══════════════════════════╧════════════════╧═══════════════╛
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
options:
-h | --help
show this help message and exit
--input_ts INPUT_TS
[optional though required if using within Python, default is '-' (stdin)]
Whether from a file or standard input, data requires a single line header
of column names. The default header is the first line of the input,
but this can be changed for CSV files using the 'skiprows' option.
Most common date formats can be used, but the closer to ISO 8601 date/time
standard the better.
Comma-separated values (CSV) files or tab-separated values (TSV):
File separators will be automatically detected.
Columns can be selected by name or index, where the index for
data columns starts at 1.
Command line examples:
┌─────────────────────────────────┬───────────────────────────┐
│ Keyword Example │ Description │
╞═════════════════════════════════╪═══════════════════════════╡
│ --input_ts=fn.csv │ read all columns from │
│ │ 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,1 │ read data columns 2 and 1 │
│ │ from 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,skiprows=2 │ read data column 2 from │
│ │ 'fn.csv', skipping first │
│ │ 2 rows so header is read │
│ │ from third row │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.xlsx,2,Sheet21 │ read all data from 2nd │
│ │ sheet all data from │
│ │ "Sheet21" of 'fn.xlsx' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.hdf5,Table12,T2 │ read all data from table │
│ │ "Table12" then all data │
│ │ from table "T2" of │
│ │ 'fn.hdf5' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.wdm,210,110 │ read DSNs 210, then 110 │
│ │ from 'fn.wdm' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' │ read all columns from │
│ │ standard input (stdin) │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' --columns=4,1 │ read column 4 and 1 from │
│ │ standard input (stdin) │
╘═════════════════════════════════╧═══════════════════════════╛
If working with CSV or TSV files you can use redirection rather than use
--input_ts=fname.csv. The following are identical:
From a file:
command subcmd --input_ts=fname.csv
From standard input (since '--input_ts=-' is the default:
command subcmd < fname.csv
Can also combine commands by piping:
command subcmd < filein.csv | command subcmd1 > fileout.csv
Python library examples:
You must use the `input_ts=...` option where `input_ts` can be
one of a [pandas DataFrame, pandas Series, dict, tuple, list,
StringIO, or file name].
--columns COLUMNS
[optional, defaults to all columns, input filter]
Columns to select out of input. Can use column names from the first line
header or column numbers. If using numbers, column number 1 is the
first data column. To pick multiple columns; separate by commas with
no spaces. As used in toolbox_utils pick command.
This solves a big problem so that you don't have to create a data set with
a certain column order, you can rearrange columns when data is read
in.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
--precip_col PRECIP_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily precipitation.
--temp_min_col TEMP_MIN_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily minimum temperature.
--temp_max_col TEMP_MAX_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily maximum temperature.
--hum_min_col HUM_MIN_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily minimum humidity.
--hum_max_col HUM_MAX_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily maximum humidity.
--hum_mean_col HUM_MEAN_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily maximum humidity.
--a0 A0
The "a0" parameter.
--a1 A1
The "a1" parameter.
--kr KR
Parameter for the "linear_dewpoint_variation" method.
--hourly_temp HOURLY_TEMP
Filename of a CSV file that contains an hourly time series of
temperatures.
--hourly_precip_hum HOURLY_PRECIP_HUM
Filename of a CSV file that contains an hourly time series of
precipitation and humidity.
--preserve_daily_mean PRESERVE_DAILY_MEAN
Column name or index (data columns start at 1) that identifies the
observed daily mean humidity. If not None will correct the daily
mean values of the disaggregated data with the observed daily mean
humidity.
disaggregate precipitation¶
$ mettoolbox disaggregate precipitation --help
<string>:37: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
usage: mettoolbox disaggregate precipitation [-h] [--input_ts INPUT_TS]
[--start_date START_DATE] [--end_date END_DATE] [--dropna DROPNA] [--clean]
[--round_index ROUND_INDEX] [--skiprows SKIPROWS] [--index_type INDEX_TYPE]
[--names NAMES] [--target_units TARGET_UNITS] [--print_input] [--tablefmt
TABLEFMT] [--columns COLUMNS] [--masterstation_hour_col
MASTERSTATION_HOUR_COL] method source_units
Disaggregate daily precipitation to hourly precipitation.
positional arguments:
method Disaggregation methods available for precipitation.
┌───────────────┬─────────────────────────────────────────────────────┐
│ method │ Description │
╞═══════════════╪═════════════════════════════════════════════════════╡
│ equal │ In order to derive hourly from daily values, the │
│ │ daily total is simply divided by 24 resulting in an │
│ │ equal distribution. │
├───────────────┼─────────────────────────────────────────────────────┤
│ cascade │ The cascade model is more complex and requires a │
│ │ parameter estimation method. │
├───────────────┼─────────────────────────────────────────────────────┤
│ masterstation │ If hourly values are available for another site in │
│ │ the vicinity of the station considered, the │
│ │ cumulative sub-daily mass curve can be transferred │
│ │ from the station that provides hourly values to the │
│ │ station of interest. │
╘═══════════════╧═════════════════════════════════════════════════════╛
Block quote ends without a blank line; unexpected unindent.
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
options:
-h | --help
show this help message and exit
--input_ts INPUT_TS
[optional though required if using within Python, default is '-' (stdin)]
Whether from a file or standard input, data requires a single line header
of column names. The default header is the first line of the input,
but this can be changed for CSV files using the 'skiprows' option.
Most common date formats can be used, but the closer to ISO 8601 date/time
standard the better.
Comma-separated values (CSV) files or tab-separated values (TSV):
File separators will be automatically detected.
Columns can be selected by name or index, where the index for
data columns starts at 1.
Command line examples:
┌─────────────────────────────────┬───────────────────────────┐
│ Keyword Example │ Description │
╞═════════════════════════════════╪═══════════════════════════╡
│ --input_ts=fn.csv │ read all columns from │
│ │ 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,1 │ read data columns 2 and 1 │
│ │ from 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,skiprows=2 │ read data column 2 from │
│ │ 'fn.csv', skipping first │
│ │ 2 rows so header is read │
│ │ from third row │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.xlsx,2,Sheet21 │ read all data from 2nd │
│ │ sheet all data from │
│ │ "Sheet21" of 'fn.xlsx' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.hdf5,Table12,T2 │ read all data from table │
│ │ "Table12" then all data │
│ │ from table "T2" of │
│ │ 'fn.hdf5' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.wdm,210,110 │ read DSNs 210, then 110 │
│ │ from 'fn.wdm' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' │ read all columns from │
│ │ standard input (stdin) │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' --columns=4,1 │ read column 4 and 1 from │
│ │ standard input (stdin) │
╘═════════════════════════════════╧═══════════════════════════╛
If working with CSV or TSV files you can use redirection rather than use
--input_ts=fname.csv. The following are identical:
From a file:
command subcmd --input_ts=fname.csv
From standard input (since '--input_ts=-' is the default:
command subcmd < fname.csv
Can also combine commands by piping:
command subcmd < filein.csv | command subcmd1 > fileout.csv
Python library examples:
You must use the `input_ts=...` option where `input_ts` can be
one of a [pandas DataFrame, pandas Series, dict, tuple, list,
StringIO, or file name].
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
--columns COLUMNS
[optional, defaults to all columns, input filter]
Columns to select out of input. Can use column names from the first line
header or column numbers. If using numbers, column number 1 is the
first data column. To pick multiple columns; separate by commas with
no spaces. As used in toolbox_utils pick command.
This solves a big problem so that you don't have to create a data set with
a certain column order, you can rearrange columns when data is read
in.
--masterstation_hour_col MASTERSTATION_HOUR_COL
The column number or name that contains the hourly data used as the
reference station.
disaggregate radiation¶
$ mettoolbox disaggregate radiation --help
<string>:51: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
usage: mettoolbox disaggregate radiation [-h] [--input_ts INPUT_TS]
[--columns COLUMNS] [--start_date START_DATE] [--end_date END_DATE] [--dropna
DROPNA] [--clean] [--round_index ROUND_INDEX] [--skiprows SKIPROWS]
[--index_type INDEX_TYPE] [--names NAMES] [--target_units TARGET_UNITS]
[--print_input] [--tablefmt TABLEFMT] [--pot_rad POT_RAD] [--angstr_a
ANGSTR_A] [--angstr_b ANGSTR_B] [--bristcamp_a BRISTCAMP_A] [--bristcamp_c
BRISTCAMP_C] [--mean_course MEAN_COURSE] [--lat LAT] [--lon LON]
[--hourly_rad HOURLY_RAD] [--glob_swr_col GLOB_SWR_COL] [--ssd_col SSD_COL]
[--temp_min_col TEMP_MIN_COL] [--temp_max_col TEMP_MAX_COL] method
source_units
Disaggregate daily radiation to hourly radiation.
positional arguments:
method Disaggregation methods available for radiation
┌─────────────────┬──────────────────────────────────────────────────┐
│ method │ Description │
╞═════════════════╪══════════════════════════════════════════════════╡
│ pot_rad │ This method allows one to disaggregate daily │
│ │ averages of shortwave radiation using hourly │
│ │ values of potential (clear-sky) radiation │
│ │ calculated for the location of the station. │
├─────────────────┼──────────────────────────────────────────────────┤
│ pot_rad_via_ssd │ If daily sunshine recordings are available, the │
│ │ Angstrom model is applied to transform sunshine │
│ │ duration to shortwave radiation. │
├─────────────────┼──────────────────────────────────────────────────┤
│ pot_rad_via_bc │ In this case, the Bristow-Campbell model is │
│ │ applied which relates minimum and maximum │
│ │ temperature to shortwave radiation. │
├─────────────────┼──────────────────────────────────────────────────┤
│ mean_course │ hourly radiation follows an observed average │
│ │ course (calculated for each month) while │
│ │ preserving the daily mean. │
╘═════════════════╧══════════════════════════════════════════════════╛
Block quote ends without a blank line; unexpected unindent.
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
options:
-h | --help
show this help message and exit
--input_ts INPUT_TS
[optional though required if using within Python, default is '-' (stdin)]
Whether from a file or standard input, data requires a single line header
of column names. The default header is the first line of the input,
but this can be changed for CSV files using the 'skiprows' option.
Most common date formats can be used, but the closer to ISO 8601 date/time
standard the better.
Comma-separated values (CSV) files or tab-separated values (TSV):
File separators will be automatically detected.
Columns can be selected by name or index, where the index for
data columns starts at 1.
Command line examples:
┌─────────────────────────────────┬───────────────────────────┐
│ Keyword Example │ Description │
╞═════════════════════════════════╪═══════════════════════════╡
│ --input_ts=fn.csv │ read all columns from │
│ │ 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,1 │ read data columns 2 and 1 │
│ │ from 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,skiprows=2 │ read data column 2 from │
│ │ 'fn.csv', skipping first │
│ │ 2 rows so header is read │
│ │ from third row │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.xlsx,2,Sheet21 │ read all data from 2nd │
│ │ sheet all data from │
│ │ "Sheet21" of 'fn.xlsx' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.hdf5,Table12,T2 │ read all data from table │
│ │ "Table12" then all data │
│ │ from table "T2" of │
│ │ 'fn.hdf5' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.wdm,210,110 │ read DSNs 210, then 110 │
│ │ from 'fn.wdm' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' │ read all columns from │
│ │ standard input (stdin) │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' --columns=4,1 │ read column 4 and 1 from │
│ │ standard input (stdin) │
╘═════════════════════════════════╧═══════════════════════════╛
If working with CSV or TSV files you can use redirection rather than use
--input_ts=fname.csv. The following are identical:
From a file:
command subcmd --input_ts=fname.csv
From standard input (since '--input_ts=-' is the default:
command subcmd < fname.csv
Can also combine commands by piping:
command subcmd < filein.csv | command subcmd1 > fileout.csv
Python library examples:
You must use the `input_ts=...` option where `input_ts` can be
one of a [pandas DataFrame, pandas Series, dict, tuple, list,
StringIO, or file name].
--columns COLUMNS
[optional, defaults to all columns, input filter]
Columns to select out of input. Can use column names from the first line
header or column numbers. If using numbers, column number 1 is the
first data column. To pick multiple columns; separate by commas with
no spaces. As used in toolbox_utils pick command.
This solves a big problem so that you don't have to create a data set with
a certain column order, you can rearrange columns when data is read
in.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
--pot_rad POT_RAD
hourly dataframe including potential radiation
--angstr_a ANGSTR_A
parameter a of the Angstrom model (intercept)
--angstr_b ANGSTR_B
parameter b of the Angstrom model (slope)
--bristcamp_a BRISTCAMP_A
parameter a for bristcamp
--bristcamp_c BRISTCAMP_C
parameter c for bristcamp
--mean_course MEAN_COURSE
Filename of HOURLY CSV file that contains radiation values to be used with
the "mean_course" method.
--lat LAT
Latitude
--lon LON
Longitude
--hourly_rad HOURLY_RAD
monthly values of the mean hourly radiation course
--glob_swr_col GLOB_SWR_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the mean global radiation.
--ssd_col SSD_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the solar duration.
--temp_min_col TEMP_MIN_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily minimum temperature.
--temp_max_col TEMP_MAX_COL
Column index (data columns start numbering at 1) or column name from the
input data that contains the daily maximum temperature.
disaggregate temperature¶
$ mettoolbox disaggregate temperature --help
<string>:66: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
usage: mettoolbox disaggregate temperature [-h] [--min_max_time MIN_MAX_TIME]
[--mod_nighttime] [--input_ts INPUT_TS] [--start_date START_DATE] [--end_date
END_DATE] [--dropna DROPNA] [--clean] [--round_index ROUND_INDEX]
[--skiprows SKIPROWS] [--index_type INDEX_TYPE] [--names NAMES]
[--target_units TARGET_UNITS] [--print_input] [--tablefmt TABLEFMT]
[--temp_min_col TEMP_MIN_COL] [--temp_max_col TEMP_MAX_COL] [--temp_mean_col
TEMP_MEAN_COL] [--lat LAT] [--lon LON] [--hourly HOURLY] [--max_delta]
method source_units
For straight disaggregation the temperature units are not relevant, however
other tools in mettoolbox require metric units. You can use source_units and
target_units keywords to change units.
┌───────────────┬────────────────────────────────────────────────────────┐
│ Input Data │ Description │
╞═══════════════╪════════════════════════════════════════════════════════╡
│ temp_min_col │ Required column name or number representing the │
│ │ minimum daily temperature. │
├───────────────┼────────────────────────────────────────────────────────┤
│ temp_max_col │ Required column name or number representing the │
│ │ maximum daily temperature. │
├───────────────┼────────────────────────────────────────────────────────┤
│ temp_mean_col │ Optional column name or number representing the │
│ │ average daily temperature. Default is None and if None │
│ │ will be calculated as average of temp_min_col and │
╘═══════════════╧═temp_max_col.══════════════════════════════════════════╛
positional arguments:
method Disaggregation methods available for temperature.
┌─────────────────────┬──────────────────────────────────────────────┐
│ method │ Description │
╞═════════════════════╪══════════════════════════════════════════════╡
│ sine_min_max │ Standard sine redistribution; preserves Tmin │
│ │ and Tmax but not Tmean. │
├─────────────────────┼──────────────────────────────────────────────┤
│ sine_mean │ Sine redistribution; preserves Tmean and the │
│ │ diurnal temperature range (Tmax – Tmin) but │
│ │ not Tmin and Tmax. │
├─────────────────────┼──────────────────────────────────────────────┤
│ mean_course_min_max │ Redistribute following a prescribed │
│ │ temperature course calculated from hourly │
│ │ observations; preserves Tmin and Tmax. │
│ │ Hourly CSV filename specified with the │
│ │ hourly keyword. │
├─────────────────────┼──────────────────────────────────────────────┤
│ mean_course_mean │ Redistribute following a prescribed │
│ │ temperature course calculated from hourly │
│ │ observations; preserves Tmean and the │
│ │ diurnal temperature range. Hourly CSV │
│ │ filename specified with the hourly keyword. │
╘═════════════════════╧══════════════════════════════════════════════╛
Block quote ends without a blank line; unexpected unindent.
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
options:
-h | --help
show this help message and exit
--min_max_time MIN_MAX_TIME
┌────────────────┬───────────────────────────────────────────────────┐
│ min_max_time │ Description │
╞════════════════╪═══════════════════════════════════════════════════╡
│ fix │ The diurnal course of temperature is fixed │
│ │ without any seasonal variations for sine method │
├────────────────┼───────────────────────────────────────────────────┤
│ sun_loc │ The diurnal course of temperature is modelled │
│ │ based on sunrise, noon and sunset calculations │
│ │ for sine method. │
├────────────────┼───────────────────────────────────────────────────┤
│ sun_loc_shift │ This option activates empirical corrections of │
│ │ the ideal course modelled by sun_loc for sine │
│ │ method. Hourly CSV filename specifiedwith the │
│ │ hourly keyword. │
╘════════════════╧═══════════════════════════════════════════════════╛
--mod_nighttime
Allows one to apply a linear interpolation of night time values, which
proves preferable during polar nights.
--input_ts INPUT_TS
[optional though required if using within Python, default is '-' (stdin)]
Whether from a file or standard input, data requires a single line header
of column names. The default header is the first line of the input,
but this can be changed for CSV files using the 'skiprows' option.
Most common date formats can be used, but the closer to ISO 8601 date/time
standard the better.
Comma-separated values (CSV) files or tab-separated values (TSV):
File separators will be automatically detected.
Columns can be selected by name or index, where the index for
data columns starts at 1.
Command line examples:
┌─────────────────────────────────┬───────────────────────────┐
│ Keyword Example │ Description │
╞═════════════════════════════════╪═══════════════════════════╡
│ --input_ts=fn.csv │ read all columns from │
│ │ 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,1 │ read data columns 2 and 1 │
│ │ from 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,skiprows=2 │ read data column 2 from │
│ │ 'fn.csv', skipping first │
│ │ 2 rows so header is read │
│ │ from third row │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.xlsx,2,Sheet21 │ read all data from 2nd │
│ │ sheet all data from │
│ │ "Sheet21" of 'fn.xlsx' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.hdf5,Table12,T2 │ read all data from table │
│ │ "Table12" then all data │
│ │ from table "T2" of │
│ │ 'fn.hdf5' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.wdm,210,110 │ read DSNs 210, then 110 │
│ │ from 'fn.wdm' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' │ read all columns from │
│ │ standard input (stdin) │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' --columns=4,1 │ read column 4 and 1 from │
│ │ standard input (stdin) │
╘═════════════════════════════════╧═══════════════════════════╛
If working with CSV or TSV files you can use redirection rather than use
--input_ts=fname.csv. The following are identical:
From a file:
command subcmd --input_ts=fname.csv
From standard input (since '--input_ts=-' is the default:
command subcmd < fname.csv
Can also combine commands by piping:
command subcmd < filein.csv | command subcmd1 > fileout.csv
Python library examples:
You must use the `input_ts=...` option where `input_ts` can be
one of a [pandas DataFrame, pandas Series, dict, tuple, list,
StringIO, or file name].
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
--temp_min_col TEMP_MIN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily minimum temperature.
--temp_max_col TEMP_MAX_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily maximum temperature.
--temp_mean_col TEMP_MEAN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily mean temperature. If None will be
estimated by the average of temp_min_col and temp_max_col.
--lat LAT
The latitude of the station. Required if min_max_time is "sun_loc" or
"sun_loc_shift".
--lon LON
The longitude of the station. Required if min_max_time is "sun_loc" or
"sun_loc_shift".
--hourly HOURLY
File name that contains the hourly time series of temperatures to use when
method is "mean_course_min" or "mean_course_mean" or when max_delta
is True.
--max_delta
Uses maximum delta of hourly values for each month to constrain the
disaggregated hourly temperature values. If set to True requires an
hourly time-series filename specified with the hourly keyword.
disaggregate wind_speed¶
$ mettoolbox disaggregate wind_speed --help
<string>:35: (WARNING/2) Block quote ends without a blank line; unexpected unindent.
usage: mettoolbox disaggregate wind_speed [-h] [--input_ts INPUT_TS]
[--columns COLUMNS] [--start_date START_DATE] [--end_date END_DATE] [--dropna
DROPNA] [--clean] [--round_index ROUND_INDEX] [--skiprows SKIPROWS]
[--index_type INDEX_TYPE] [--names NAMES] [--target_units TARGET_UNITS]
[--print_input] [--tablefmt TABLEFMT] [-a A] [-b B] [--t_shift T_SHIFT]
method source_units
Disaggregate daily wind speed to hourly wind speed.
positional arguments:
method Disaggregation methods available for wind speed.
┌──────────┬─────────────────────────────────────────────────────────┐
│ method │ Description │
╞══════════╪═════════════════════════════════════════════════════════╡
│ equal │ If this method is chosen, the daily average wind speed │
│ │ is assumed to be valid for each hour on that day. │
├──────────┼─────────────────────────────────────────────────────────┤
│ cosine │ The cosine function option simulates a diurnal course │
│ │ of wind speed and requires calibration │
├──────────┼─(calc_wind_stats()).────────────────────────────────────┤
│ random │ This option is a stochastic method that draws random │
│ │ numbers to disaggregate wind speed taking into account │
│ │ the daily average (no parameter estimation required). │
╘══════════╧═════════════════════════════════════════════════════════╛
Block quote ends without a blank line; unexpected unindent.
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
options:
-h | --help
show this help message and exit
--input_ts INPUT_TS
[optional though required if using within Python, default is '-' (stdin)]
Whether from a file or standard input, data requires a single line header
of column names. The default header is the first line of the input,
but this can be changed for CSV files using the 'skiprows' option.
Most common date formats can be used, but the closer to ISO 8601 date/time
standard the better.
Comma-separated values (CSV) files or tab-separated values (TSV):
File separators will be automatically detected.
Columns can be selected by name or index, where the index for
data columns starts at 1.
Command line examples:
┌─────────────────────────────────┬───────────────────────────┐
│ Keyword Example │ Description │
╞═════════════════════════════════╪═══════════════════════════╡
│ --input_ts=fn.csv │ read all columns from │
│ │ 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,1 │ read data columns 2 and 1 │
│ │ from 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,skiprows=2 │ read data column 2 from │
│ │ 'fn.csv', skipping first │
│ │ 2 rows so header is read │
│ │ from third row │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.xlsx,2,Sheet21 │ read all data from 2nd │
│ │ sheet all data from │
│ │ "Sheet21" of 'fn.xlsx' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.hdf5,Table12,T2 │ read all data from table │
│ │ "Table12" then all data │
│ │ from table "T2" of │
│ │ 'fn.hdf5' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.wdm,210,110 │ read DSNs 210, then 110 │
│ │ from 'fn.wdm' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' │ read all columns from │
│ │ standard input (stdin) │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' --columns=4,1 │ read column 4 and 1 from │
│ │ standard input (stdin) │
╘═════════════════════════════════╧═══════════════════════════╛
If working with CSV or TSV files you can use redirection rather than use
--input_ts=fname.csv. The following are identical:
From a file:
command subcmd --input_ts=fname.csv
From standard input (since '--input_ts=-' is the default:
command subcmd < fname.csv
Can also combine commands by piping:
command subcmd < filein.csv | command subcmd1 > fileout.csv
Python library examples:
You must use the `input_ts=...` option where `input_ts` can be
one of a [pandas DataFrame, pandas Series, dict, tuple, list,
StringIO, or file name].
--columns COLUMNS
[optional, defaults to all columns, input filter]
Columns to select out of input. Can use column names from the first line
header or column numbers. If using numbers, column number 1 is the
first data column. To pick multiple columns; separate by commas with
no spaces. As used in toolbox_utils pick command.
This solves a big problem so that you don't have to create a data set with
a certain column order, you can rearrange columns when data is read
in.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
-a A
Parameter a when method is equal to "cosine".
-b B
Parameter b when method is equal to "cosine".
--t_shift T_SHIFT
Parameter t_shift when method is equal to "cosine".
indices¶
$ mettoolbox indices --help
usage: mettoolbox indices [-h] {spei,pe} ...
positional arguments:
{spei,pe}
spei Standard Precipitation/Evaporation Index.
pe Precipitation minus evaporation index.
options:
-h, --help show this help message and exit
indices pe¶
$ mettoolbox indices pe --help
<string>:27: (WARNING/2) Definition list ends without a blank line; unexpected unindent.
usage: mettoolbox indices pe [-h] [--nsmallest NSMALLEST]
[--nlargest NLARGEST] [--groupby GROUPBY] [--window WINDOW] [--min_periods
MIN_PERIODS] [--center] [--win_type WIN_TYPE] [--closed CLOSED] [--input_ts
INPUT_TS] [--start_date START_DATE] [--end_date END_DATE] [--dropna DROPNA]
[--clean] [--round_index ROUND_INDEX] [--index_type INDEX_TYPE] [--names
NAMES] [--target_units TARGET_UNITS] [--print_input] [--tablefmt TABLEFMT]
rainfall pet source_units
Calculates a windows cumulative sum of daily precipitation minus evaporation.
positional arguments:
rainfall A csv, wdm, hdf5, xlsx file or a pandas DataFrame or Series or
an integer column or string name of standard input.
Represents a daily time-series of precipitation in units specified in
source_units.
pet A csv, wdm, hdf5, xlsx file or a pandas DataFrame or Series or
an integer column or string name of standard input.
Represents a daily time-series of evaporation in units specified in
source_units.
Definition list ends without a blank line; unexpected unindent.
source_units [optional, default is None, transformation]
If unit is specified for the column as the second field of a ':' delimited
column name, then the specified units and the 'source_units' must match
exactly.
Any unit string compatible with the 'pint' library can be used.
options:
-h | --help
show this help message and exit
--nsmallest NSMALLEST
[optional, default is None]
Return the "n" days with the smallest precipitation minus evaporation
index value within the groupby pandas offset period.
Cannot assign both nsmallest and nlargest keywords.
--nlargest NLARGEST
[optional, default is None]
Return the "n" days with the largest precipitation minus evaporation index
value within the groupby pandas offset period.
Cannot assign both nsmallest and nlargest keywords.
--groupby GROUPBY
Pandas offset period string representing the time over which the nsmallest
or nlargest values would be evaluated.
--window WINDOW
[optional, default is 30]
Size of the moving window. This is the number of observations used for
calculating the statistic. Each window will be a fixed size.
If its an offset then this will be the time period of each window. Each
window will be a variable sized based on the observations included
in the time-period. This is only valid for datetimelike indexes.
--min_periods MIN_PERIODS
Minimum number of observations in window required to have a value
(otherwise result is NA). For a window that is specified by an
offset, min_periods will default to 1. Otherwise, min_periods will
default to the size of the window.
--center
Set the labels at the center of the window.
--win_type WIN_TYPE
Provide a window type. If None, all points are evenly weighted. See the
notes below for further information.
--closed CLOSED
Make the interval closed on the ‘right’, ‘left’, ‘both’ or ‘neither’
endpoints. Defaults to ‘right’.
--input_ts INPUT_TS
[optional though required if using within Python, default is '-' (stdin)]
Whether from a file or standard input, data requires a single line header
of column names. The default header is the first line of the input,
but this can be changed for CSV files using the 'skiprows' option.
Most common date formats can be used, but the closer to ISO 8601 date/time
standard the better.
Comma-separated values (CSV) files or tab-separated values (TSV):
File separators will be automatically detected.
Columns can be selected by name or index, where the index for
data columns starts at 1.
Command line examples:
┌─────────────────────────────────┬───────────────────────────┐
│ Keyword Example │ Description │
╞═════════════════════════════════╪═══════════════════════════╡
│ --input_ts=fn.csv │ read all columns from │
│ │ 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,1 │ read data columns 2 and 1 │
│ │ from 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,skiprows=2 │ read data column 2 from │
│ │ 'fn.csv', skipping first │
│ │ 2 rows so header is read │
│ │ from third row │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.xlsx,2,Sheet21 │ read all data from 2nd │
│ │ sheet all data from │
│ │ "Sheet21" of 'fn.xlsx' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.hdf5,Table12,T2 │ read all data from table │
│ │ "Table12" then all data │
│ │ from table "T2" of │
│ │ 'fn.hdf5' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.wdm,210,110 │ read DSNs 210, then 110 │
│ │ from 'fn.wdm' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' │ read all columns from │
│ │ standard input (stdin) │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' --columns=4,1 │ read column 4 and 1 from │
│ │ standard input (stdin) │
╘═════════════════════════════════╧═══════════════════════════╛
If working with CSV or TSV files you can use redirection rather than use
--input_ts=fname.csv. The following are identical:
From a file:
command subcmd --input_ts=fname.csv
From standard input (since '--input_ts=-' is the default:
command subcmd < fname.csv
Can also combine commands by piping:
command subcmd < filein.csv | command subcmd1 > fileout.csv
Python library examples:
You must use the `input_ts=...` option where `input_ts` can be
one of a [pandas DataFrame, pandas Series, dict, tuple, list,
StringIO, or file name].
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
indices spei¶
$ mettoolbox indices spei --help
<string>:26: (WARNING/2) Definition list ends without a blank line; unexpected unindent.
usage: mettoolbox indices spei [-h] [--nsmallest NSMALLEST]
[--nlargest NLARGEST] [--groupby GROUPBY] [--fit_type FIT_TYPE] [--dist_type
DIST_TYPE] [--scale SCALE] [--input_ts INPUT_TS] [--start_date START_DATE]
[--end_date END_DATE] [--dropna DROPNA] [--clean] [--round_index
ROUND_INDEX] [--skiprows SKIPROWS] [--index_type INDEX_TYPE] [--names NAMES]
[--print_input] [--tablefmt TABLEFMT] rainfall pet source_units
Calculates a windows cumulative sum of daily precipitation minus evaporation.
positional arguments:
rainfall A csv, wdm, hdf5, xlsx file or a pandas DataFrame or Series or
an integer column or string name of standard input.
Represents a daily time-series of precipitation in units specified in
source_units.
pet A csv, wdm, hdf5, xlsx file or a pandas DataFrame or Series or
an integer column or string name of standard input.
Represents a daily time-series of evaporation in units specified in
source_units.
Definition list ends without a blank line; unexpected unindent.
source_units [optional, default is None, transformation]
If unit is specified for the column as the second field of a ':' delimited
column name, then the specified units and the 'source_units' must match
exactly.
Any unit string compatible with the 'pint' library can be used.
options:
-h | --help
show this help message and exit
--nsmallest NSMALLEST
[optional, default is None]
Return the "n" days with the smallest precipitation minus evaporation
index value within the groupby pandas offset period.
Cannot assign both nsmallest and nlargest keywords.
--nlargest NLARGEST
[optional, default is None]
Return the "n" days with the largest precipitation minus evaporation index
value within the groupby pandas offset period.
Cannot assign both nsmallest and nlargest keywords.
--groupby GROUPBY
Pandas offset period string representing the time over which the nsmallest
or nlargest values would be evaluated.
--fit_type FIT_TYPE
Specify the type of fit to use for fitting distribution to the
precipitation data. Either L-moments (lmom) or Maximum Likelihood
Estimation (mle). Note use L-moments when comparing to NCAR's NCL
code and R's packages to calculate SPI and SPEI.
--dist_type DIST_TYPE
The distribution type to fit using either L-moments (fit_type="lmom") or
MLE (fit_type="mle").
┌───────────┬───────────────────────────┬───────────┬──────────┐
│ dist_type │ Distribution │ fit_type │ fit_type │
│ │ │ lmom │ mle │
╞═══════════╪═══════════════════════════╪═══════════╪══════════╡
│ gam │ Gamma │ X │ X │
├───────────┼───────────────────────────┼───────────┼──────────┤
│ exp │ Exponential │ X │ X │
├───────────┼───────────────────────────┼───────────┼──────────┤
│ gev │ Generalized Extreme Value │ X │ X │
├───────────┼───────────────────────────┼───────────┼──────────┤
│ gpa │ Generalized Pareto │ X │ X │
├───────────┼───────────────────────────┼───────────┼──────────┤
│ gum │ Gumbel │ X │ X │
├───────────┼───────────────────────────┼───────────┼──────────┤
│ nor │ Normal │ X │ X │
├───────────┼───────────────────────────┼───────────┼──────────┤
│ pe3 │ Pearson III │ X │ X │
├───────────┼───────────────────────────┼───────────┼──────────┤
│ wei │ Weibull │ X │ X │
├───────────┼───────────────────────────┼───────────┼──────────┤
│ glo │ Generalized Logistic │ │ X │
├───────────┼───────────────────────────┼───────────┼──────────┤
│ gno │ Generalized Normal │ │ X │
├───────────┼───────────────────────────┼───────────┼──────────┤
│ kap │ Kappa │ │ X │
├───────────┼───────────────────────────┼───────────┼──────────┤
│ wak │ Wakeby │ X │ │
╘═══════════╧═══════════════════════════╧═══════════╧══════════╛
--scale SCALE
Integer to specify the number of time periods over which the standardized
precipitation index is to be calculated. If freq="M" then this is
the number of months.
--input_ts INPUT_TS
[optional though required if using within Python, default is '-' (stdin)]
Whether from a file or standard input, data requires a single line header
of column names. The default header is the first line of the input,
but this can be changed for CSV files using the 'skiprows' option.
Most common date formats can be used, but the closer to ISO 8601 date/time
standard the better.
Comma-separated values (CSV) files or tab-separated values (TSV):
File separators will be automatically detected.
Columns can be selected by name or index, where the index for
data columns starts at 1.
Command line examples:
┌─────────────────────────────────┬───────────────────────────┐
│ Keyword Example │ Description │
╞═════════════════════════════════╪═══════════════════════════╡
│ --input_ts=fn.csv │ read all columns from │
│ │ 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,1 │ read data columns 2 and 1 │
│ │ from 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,skiprows=2 │ read data column 2 from │
│ │ 'fn.csv', skipping first │
│ │ 2 rows so header is read │
│ │ from third row │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.xlsx,2,Sheet21 │ read all data from 2nd │
│ │ sheet all data from │
│ │ "Sheet21" of 'fn.xlsx' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.hdf5,Table12,T2 │ read all data from table │
│ │ "Table12" then all data │
│ │ from table "T2" of │
│ │ 'fn.hdf5' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.wdm,210,110 │ read DSNs 210, then 110 │
│ │ from 'fn.wdm' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' │ read all columns from │
│ │ standard input (stdin) │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' --columns=4,1 │ read column 4 and 1 from │
│ │ standard input (stdin) │
╘═════════════════════════════════╧═══════════════════════════╛
If working with CSV or TSV files you can use redirection rather than use
--input_ts=fname.csv. The following are identical:
From a file:
command subcmd --input_ts=fname.csv
From standard input (since '--input_ts=-' is the default:
command subcmd < fname.csv
Can also combine commands by piping:
command subcmd < filein.csv | command subcmd1 > fileout.csv
Python library examples:
You must use the `input_ts=...` option where `input_ts` can be
one of a [pandas DataFrame, pandas Series, dict, tuple, list,
StringIO, or file name].
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
pet¶
$ mettoolbox pet --help
usage: mettoolbox pet [-h]
{allen,blaney_criddle,hamon,hargreaves,linacre,oudin_form,priestley_taylor,romanenko}
...
positional arguments:
{allen,blaney_criddle,hamon,hargreaves,linacre,oudin_form,priestley_taylor,romanenko}
allen Allen PET: f(Tmin, Tmax, Tavg, latitude)
blaney_criddle Evaporation calculated according to [blaney_1952]_.
hamon Hamon PET: f(Tavg, latitude)
hargreaves Hargreaves PET: f(Tmin, Tmax, Tavg, latitude)
linacre Evaporation calculated according to [linacre_1977]_.
oudin_form Oudin PET: f(Tavg, latitude)
priestley_taylor priestley_taylor PET: f(Tmin, Tmax, Tavg, latitude)
romanenko Evaporation calculated according to [romanenko_1961]_.
options:
-h, --help show this help message and exit
pet allen¶
$ mettoolbox pet allen --help
usage: mettoolbox pet allen [-h] [--temp_mean_col TEMP_MEAN_COL]
[--start_date START_DATE] [--end_date END_DATE] [--dropna DROPNA] [--clean]
[--round_index ROUND_INDEX] [--skiprows SKIPROWS] [--index_type INDEX_TYPE]
[--names NAMES] [--target_units TARGET_UNITS] [--print_input] [--tablefmt
TABLEFMT] lat temp_min_col temp_max_col source_units
Average daily temperature can be supplied or if not, calculated by
(Tmax+Tmin)/2.
positional arguments:
lat The latitude of the station. Positive specifies the Northern
Hemisphere, and negative values represent the Southern Hemisphere.
temp_min_col The column name or number (data columns start numbering at 1) in
the input data that represents the daily minimum temperature.
temp_max_col The column name or number (data columns start numbering at 1) in
the input data that represents the daily maximum temperature.
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
Since there are two required input columns ("temp_min_col" and
"temp_max_col") and one optional input column ("temp_mean_col") you need
to supply units for each input column in source_units.
Command line:
mettoolbox pet allen 24 1 2 degF,degF < tmin_tmax_data.csv
Python:
from mettoolbox import mettoolbox as mt
df = mt.pet.allen(24,
1,
2,
["degF", "degF"],
input_ts="tmin_tmax_data.csv")
options:
-h | --help
show this help message and exit
--temp_mean_col TEMP_MEAN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily mean temperature. If None will be
estimated by the average of temp_min_col and temp_max_col.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
pet blaney_criddle¶
$ mettoolbox pet blaney_criddle --help
usage: mettoolbox pet blaney_criddle [-h] [--temp_mean_col TEMP_MEAN_COL]
[--temp_min_col TEMP_MIN_COL] [--temp_max_col TEMP_MAX_COL] [-k K]
[--start_date START_DATE] [--end_date END_DATE] [--dropna DROPNA] [--clean]
[--round_index ROUND_INDEX] [--skiprows SKIPROWS] [--names NAMES]
[--target_units TARGET_UNITS] [--print_input] [--tablefmt TABLEFMT]
bright_hours_col source_units
Average daily temperature can be supplied or if not, calculated by
(Tmax+Tmin)/2.
positional arguments:
bright_hours_col The column number (data columns start at 1) or column name that holds
the time-series of the number of bright hours each day.
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
Since there are two required input columns ("temp_min_col" and
"temp_max_col") and one optional input column ("temp_mean_col") you need
to supply units for each input column in source_units.
Command line:
mettoolbox pet hamon 24 1 2 degF,degF < tmin_tmax_data.csv
Python:
from mettoolbox import mettoolbox as mt
df = mt.pet.hamon(24,
1,
2,
["degF", "degF"],
input_ts="tmin_tmax_data.csv")
options:
-h | --help
show this help message and exit
--temp_mean_col TEMP_MEAN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily mean temperature. If None will be
estimated by the average of temp_min_col and temp_max_col.
--temp_min_col TEMP_MIN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily minimum temperature.
--temp_max_col TEMP_MAX_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily maximum temperature.
-k K
A scaling factor, defaults to 1. This is an adjustment for local
conditions, for example, Lu, 2005 found that k=1.2 was a better fit
for the southeastern United States.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
pet hamon¶
$ mettoolbox pet hamon --help
usage: mettoolbox pet hamon [-h] [--temp_mean_col TEMP_MEAN_COL]
[--temp_min_col TEMP_MIN_COL] [--temp_max_col TEMP_MAX_COL] [-k K]
[--start_date START_DATE] [--end_date END_DATE] [--dropna DROPNA] [--clean]
[--round_index ROUND_INDEX] [--skiprows SKIPROWS] [--index_type INDEX_TYPE]
[--names NAMES] [--target_units TARGET_UNITS] [--print_input] [--tablefmt
TABLEFMT] lat source_units
Average daily temperature can be supplied or if not, calculated by
(Tmax+Tmin)/2.
positional arguments:
lat The latitude of the station. Positive specifies the Northern
Hemisphere, and negative values represent the Southern Hemisphere.
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
Since there are two required input columns ("temp_min_col" and
"temp_max_col") and one optional input column ("temp_mean_col") you need
to supply units for each input column in source_units.
Command line:
mettoolbox pet hamon 24 1 2 degF,degF < tmin_tmax_data.csv
Python:
from mettoolbox import mettoolbox as mt
df = mt.pet.hamon(24,
1,
2,
["degF", "degF"],
input_ts="tmin_tmax_data.csv")
options:
-h | --help
show this help message and exit
--temp_mean_col TEMP_MEAN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily mean temperature. If None will be
estimated by the average of temp_min_col and temp_max_col.
--temp_min_col TEMP_MIN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily minimum temperature.
--temp_max_col TEMP_MAX_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily maximum temperature.
-k K
A scaling factor, defaults to 1. This is an adjustment for local
conditions, for example, Lu, 2005 found that k=1.2 was a better fit
for the southeastern United States.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
pet hargreaves¶
$ mettoolbox pet hargreaves --help
usage: mettoolbox pet hargreaves [-h] [--temp_mean_col TEMP_MEAN_COL]
[--start_date START_DATE] [--end_date END_DATE] [--dropna DROPNA] [--clean]
[--round_index ROUND_INDEX] [--skiprows SKIPROWS] [--index_type INDEX_TYPE]
[--names NAMES] [--target_units TARGET_UNITS] [--print_input] [--tablefmt
TABLEFMT] lat temp_min_col temp_max_col source_units
Average daily temperature can be supplied or if not, calculated by
(Tmax+Tmin)/2.
positional arguments:
lat The latitude of the station. Positive specifies the Northern
Hemisphere, and negative values represent the Southern Hemisphere.
temp_min_col The column name or number (data columns start numbering at 1) in
the input data that represents the daily minimum temperature.
temp_max_col The column name or number (data columns start numbering at 1) in
the input data that represents the daily maximum temperature.
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
Since there are two required input columns ("temp_min_col" and
"temp_max_col") and one optional input column ("temp_mean_col") you need
to supply units for each input column in source_units.
Command line:
mettoolbox pet hargreaves 24 1 2 degF,degF < tmin_tmax_data.csv
Python:
from mettoolbox import mettoolbox as mt
df = mt.pet.hargreaves(24,
1,
2,
["degF", "degF"],
input_ts="tmin_tmax_data.csv")
options:
-h | --help
show this help message and exit
--temp_mean_col TEMP_MEAN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily mean temperature. If None will be
estimated by the average of temp_min_col and temp_max_col.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
pet linacre¶
$ mettoolbox pet linacre --help
usage: mettoolbox pet linacre [-h] [--temp_mean_col TEMP_MEAN_COL]
[--temp_min_col TEMP_MIN_COL] [--temp_max_col TEMP_MAX_COL] [--tdew_col
TDEW_COL] [--start_date START_DATE] [--end_date END_DATE] [--dropna DROPNA]
[--clean] [--round_index ROUND_INDEX] [--skiprows SKIPROWS] [--index_type
INDEX_TYPE] [--names NAMES] [--target_units TARGET_UNITS] [--print_input]
[--tablefmt TABLEFMT] lat elevation source_units
Average daily temperature can be supplied or if not, calculated by
(Tmax+Tmin)/2.
positional arguments:
lat The latitude of the station. Positive specifies the Northern
Hemisphere, and negative values represent the Southern Hemisphere.
elevation The elevation of the station in
meters.
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
Since there are two required input columns ("temp_min_col" and
"temp_max_col") and one optional input column ("temp_mean_col") you need
to supply units for each input column in source_units.
Command line:
mettoolbox pet hargreaves 24 1 2 degF,degF < tmin_tmax_data.csv
Python:
from mettoolbox import mettoolbox as mt
df = mt.pet.hargreaves(24,
1,
2,
["degF", "degF"],
input_ts="tmin_tmax_data.csv")
options:
-h | --help
show this help message and exit
--temp_mean_col TEMP_MEAN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily mean temperature. If None will be
estimated by the average of temp_min_col and temp_max_col.
--temp_min_col TEMP_MIN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily minimum temperature.
--temp_max_col TEMP_MAX_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily maximum temperature.
--tdew_col TDEW_COL
The column name or number (data columns start numbering at 1) in the input
data that represents daily dewpoint temperature.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
pet oudin_form¶
$ mettoolbox pet oudin_form --help
usage: mettoolbox pet oudin_form [-h] [--temp_mean_col TEMP_MEAN_COL]
[--k1 K1] [--k2 K2] [--source_units SOURCE_UNITS] [--start_date START_DATE]
[--end_date END_DATE] [--dropna DROPNA] [--clean] [--round_index
ROUND_INDEX] [--skiprows SKIPROWS] [--index_type INDEX_TYPE] [--names NAMES]
[--target_units TARGET_UNITS] [--print_input] [--tablefmt TABLEFMT] lat
temp_min_col temp_max_col
This model uses daily mean temperature to estimate PET based on the Julian day
of year and latitude. The later are used to estimate extraterrestrial solar
radiation.
Average daily temperature can be supplied or if not, calculated by
(Tmax+Tmin)/2.
The constants k1 and k2 are used in the generic form of the equation to adjust
the PET.
The defaults for k1 and k2 for this function are from Oudin with k1=100 and
k2=5.
Jensen-Haise presented k1=40, and k2=0,
Mcguiness presented k1=68, and k2=5.
Reference:
Ludovic Oudin et al, Which potential evapotranspiration input for
a lumped rainfall–runoff model?: Part 2—Towards a simple and efficient
potential evapotranspiration model for rainfall–runoff modelling,
Journal of Hydrology, Volume 303, Issues 1–4, 1 March 2005, Pages
290-306, ISSN 0022-1694,
http://dx.doi.org/10.1016/j.jhydrol.2004.08.026.
(http://www.sciencedirect.com/science/article/pii/S0022169404004056)
positional arguments:
lat The latitude of the station. Positive specifies the Northern
Hemisphere, and negative values represent the Southern Hemisphere.
temp_min_col The column name or number (data columns start numbering at 1) in
the input data that represents the daily minimum temperature.
temp_max_col The column name or number (data columns start numbering at 1) in
the input data that represents the daily maximum temperature.
options:
-h | --help
show this help message and exit
--temp_mean_col TEMP_MEAN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily mean temperature. If None will be
estimated by the average of temp_min_col and temp_max_col.
--k1 K1
[optional, default to 100]
The k1 value is used to calibrate the equation to different conditions.
The k1 parameter is a scaling parameter.
--k2 K2
[optional, default to 5]
The k2 value is used to calibrate the equation to different conditions.
The k2 parameter represents the point in degrees C at which potential
evaporation is 0.
--source_units SOURCE_UNITS
If unit is specified for the column as the second field of a ':' delimited
column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
Since there are two required input columns ("temp_min_col" and
"temp_max_col") and one optional input column ("temp_mean_col") you
need to supply units for each input column in source_units.
Command line:
mettoolbox pet oudin_form 24 1 2 degF,degF < tmin_tmax_data.csv
Python:
from mettoolbox import mettoolbox as mt
df = mt.pet.oudin_form(24, 1, 2, ["degF", "degF"], input_ts="tmin_tmax_data.csv")
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
pet priestley_taylor¶
$ mettoolbox pet priestley_taylor --help
usage: mettoolbox pet priestley_taylor [-h] [--rh_col RH_COL]
[--u2_col U2_COL] [--start_date START_DATE] [--end_date END_DATE] [--dropna
DROPNA] [--clean] [--round_index ROUND_INDEX] [--skiprows SKIPROWS]
[--index_type INDEX_TYPE] [--names NAMES] [--target_units TARGET_UNITS]
[--print_input] [--tablefmt TABLEFMT] input_ts lat lon temp_min_col
temp_max_col srad_col dayl_col source_units
Average daily temperature can be supplied or if not, calculated by
(Tmax+Tmin)/2.
positional arguments:
input_ts [optional though required if using within Python, default is '-'
(stdin)]
Whether from a file or standard input, data requires a single line header of
column names. The default header is the first line of the input, but
this can be changed for CSV files using the 'skiprows' option.
Most common date formats can be used, but the closer to ISO 8601 date/time
standard the better.
Comma-separated values (CSV) files or tab-separated values (TSV):
File separators will be automatically detected.
Columns can be selected by name or index, where the index for
data columns starts at 1.
Command line examples:
┌─────────────────────────────────┬───────────────────────────┐
│ Keyword Example │ Description │
╞═════════════════════════════════╪═══════════════════════════╡
│ --input_ts=fn.csv │ read all columns from │
│ │ 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,1 │ read data columns 2 and 1 │
│ │ from 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,skiprows=2 │ read data column 2 from │
│ │ 'fn.csv', skipping first │
│ │ 2 rows so header is read │
│ │ from third row │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.xlsx,2,Sheet21 │ read all data from 2nd │
│ │ sheet all data from │
│ │ "Sheet21" of 'fn.xlsx' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.hdf5,Table12,T2 │ read all data from table │
│ │ "Table12" then all data │
│ │ from table "T2" of │
│ │ 'fn.hdf5' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.wdm,210,110 │ read DSNs 210, then 110 │
│ │ from 'fn.wdm' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' │ read all columns from │
│ │ standard input (stdin) │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' --columns=4,1 │ read column 4 and 1 from │
│ │ standard input (stdin) │
╘═════════════════════════════════╧═══════════════════════════╛
If working with CSV or TSV files you can use redirection rather than use
--input_ts=fname.csv. The following are identical:
From a file:
command subcmd --input_ts=fname.csv
From standard input (since '--input_ts=-' is the default:
command subcmd < fname.csv
Can also combine commands by piping:
command subcmd < filein.csv | command subcmd1 > fileout.csv
Python library examples:
You must use the `input_ts=...` option where `input_ts` can be
one of a [pandas DataFrame, pandas Series, dict, tuple, list,
StringIO, or file name].
lat The latitude of the station. Positive specifies the Northern
Hemisphere, and negative values represent the Southern Hemisphere.
lon The longitude of the station. Positive specifies east of the
prime meridian, and negative values represent west of the prime meridian.
temp_min_col The column name or number (data columns start numbering at 1) in
the input data that represents the daily minimum temperature.
temp_max_col The column name or number (data columns start numbering at 1) in
the input data that represents the daily maximum temperature.
srad_col The column name or number (data columns start numbering at 1) in the
input data that represents daily solar radiation.
dayl_col The column name or number (data columns start numbering at 1) in the
input data that represents daily day light fraction.
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
Since there are two required input columns ("temp_min_col" and
"temp_max_col") and one optional input column ("temp_mean_col") you need
to supply units for each input column in source_units.
Command line:
mettoolbox pet hargreaves 24 1 2 degF,degF < tmin_tmax_data.csv
Python:
from mettoolbox import mettoolbox as mt
df = mt.pet.hargreaves(24,
1,
2,
["degF", "degF"],
input_ts="tmin_tmax_data.csv")
options:
-h | --help
show this help message and exit
--rh_col RH_COL
The column name or number (data columns start numbering at 1) in the input
data that represents daily average relative humidity.
--u2_col U2_COL
The column name or number (data columns start numbering at 1) in the input
data that represents daily u2.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
pet romanenko¶
$ mettoolbox pet romanenko --help
usage: mettoolbox pet romanenko [-h] [--temp_mean_col TEMP_MEAN_COL]
[--temp_min_col TEMP_MIN_COL] [--temp_max_col TEMP_MAX_COL] [--rh_col RH_COL]
[-k K] [--start_date START_DATE] [--end_date END_DATE] [--dropna DROPNA]
[--clean] [--round_index ROUND_INDEX] [--skiprows SKIPROWS] [--names NAMES]
[--target_units TARGET_UNITS] [--print_input] [--tablefmt TABLEFMT]
source_units
Average daily temperature can be supplied or if not, calculated by
(Tmax+Tmin)/2.
positional arguments:
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
Since there are two required input columns ("temp_min_col" and
"temp_max_col") and one optional input column ("temp_mean_col") you need
to supply units for each input column in source_units.
Command line:
mettoolbox pet hamon 24 1 2 degF,degF < tmin_tmax_data.csv
Python:
from mettoolbox import mettoolbox as mt
df = mt.pet.hamon(24,
1,
2,
["degF", "degF"],
input_ts="tmin_tmax_data.csv")
options:
-h | --help
show this help message and exit
--temp_mean_col TEMP_MEAN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily mean temperature. If None will be
estimated by the average of temp_min_col and temp_max_col.
--temp_min_col TEMP_MIN_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily minimum temperature.
--temp_max_col TEMP_MAX_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily maximum temperature.
--rh_col RH_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily average relative humidity.
-k K
A scaling factor, defaults to 1. This is an adjustment for local
conditions, for example, Lu, 2005 found that k=1.2 was a better fit
for the southeastern United States.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.
ret¶
$ mettoolbox ret --help
usage: mettoolbox ret [-h] {penman_monteith} ...
positional arguments:
{penman_monteith}
penman_monteith penman_monteith PET: f(Tmin, Tmax, Tavg, latitude)
options:
-h, --help show this help message and exit
ret penman_monteith¶
$ mettoolbox ret penman_monteith --help
usage: mettoolbox ret penman_monteith [-h] [--rh_col RH_COL] [--u2_col U2_COL]
[--start_date START_DATE] [--end_date END_DATE] [--dropna DROPNA] [--clean]
[--round_index ROUND_INDEX] [--skiprows SKIPROWS] [--index_type INDEX_TYPE]
[--names NAMES] [--target_units TARGET_UNITS] [--print_input] [--tablefmt
TABLEFMT] input_ts lat lon temp_min_col temp_max_col srad_col dayl_col
source_units
Average daily temperature can be supplied or if not, calculated by
(Tmax+Tmin)/2.
positional arguments:
input_ts [optional though required if using within Python, default is '-'
(stdin)]
Whether from a file or standard input, data requires a single line header of
column names. The default header is the first line of the input, but
this can be changed for CSV files using the 'skiprows' option.
Most common date formats can be used, but the closer to ISO 8601 date/time
standard the better.
Comma-separated values (CSV) files or tab-separated values (TSV):
File separators will be automatically detected.
Columns can be selected by name or index, where the index for
data columns starts at 1.
Command line examples:
┌─────────────────────────────────┬───────────────────────────┐
│ Keyword Example │ Description │
╞═════════════════════════════════╪═══════════════════════════╡
│ --input_ts=fn.csv │ read all columns from │
│ │ 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,1 │ read data columns 2 and 1 │
│ │ from 'fn.csv' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.csv,2,skiprows=2 │ read data column 2 from │
│ │ 'fn.csv', skipping first │
│ │ 2 rows so header is read │
│ │ from third row │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.xlsx,2,Sheet21 │ read all data from 2nd │
│ │ sheet all data from │
│ │ "Sheet21" of 'fn.xlsx' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.hdf5,Table12,T2 │ read all data from table │
│ │ "Table12" then all data │
│ │ from table "T2" of │
│ │ 'fn.hdf5' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts=fn.wdm,210,110 │ read DSNs 210, then 110 │
│ │ from 'fn.wdm' │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' │ read all columns from │
│ │ standard input (stdin) │
├─────────────────────────────────┼───────────────────────────┤
│ --input_ts='-' --columns=4,1 │ read column 4 and 1 from │
│ │ standard input (stdin) │
╘═════════════════════════════════╧═══════════════════════════╛
If working with CSV or TSV files you can use redirection rather than use
--input_ts=fname.csv. The following are identical:
From a file:
command subcmd --input_ts=fname.csv
From standard input (since '--input_ts=-' is the default:
command subcmd < fname.csv
Can also combine commands by piping:
command subcmd < filein.csv | command subcmd1 > fileout.csv
Python library examples:
You must use the `input_ts=...` option where `input_ts` can be
one of a [pandas DataFrame, pandas Series, dict, tuple, list,
StringIO, or file name].
lat The latitude of the station. Positive specifies the Northern
Hemisphere, and negative values represent the Southern Hemisphere.
lon The longitude of the station. Positive specifies east of the prime
meridian, and negative values represent west of the prime meridian.
temp_min_col The column name or number (data columns start numbering at 1) in
the input data that represents the daily minimum temperature.
temp_max_col The column name or number (data columns start numbering at 1) in
the input data that represents the daily maximum temperature.
srad_col The column name or number (data columns start numbering at 1) in the
input data that represents daily solar radiation.
dayl_col The column name or number (data columns start numbering at 1) in the
input data that represents daily day light fraction.
source_units If unit is specified for the column as the second field of a ':'
delimited column name, then the specified units and the 'source_units' must
match exactly.
Any unit string compatible with the 'pint' library can be used.
Since there are two required input columns ("temp_min_col" and
"temp_max_col") and one optional input column ("temp_mean_col") you need
to supply units for each input column in source_units.
Command line:
mettoolbox pet hargreaves 24 1 2 degF,degF < tmin_tmax_data.csv
Python:
from mettoolbox import mettoolbox as mt
df = mt.pet.hargreaves(24,
1,
2,
["degF", "degF"],
input_ts="tmin_tmax_data.csv")
options:
-h | --help
show this help message and exit
--rh_col RH_COL
The column name or number (data columns start numbering at 1) in the input
data that represents the daily average relative humidity.
--u2_col U2_COL
The column name or number (data columns start numbering at 1) in the input
data that represents daily u2.
--start_date START_DATE
[optional, defaults to first date in time-series, input filter]
The start_date of the series in ISOdatetime format, or 'None' for
beginning.
--end_date END_DATE
[optional, defaults to last date in time-series, input filter]
The end_date of the series in ISOdatetime format, or 'None' for end.
--dropna DROPNA
[optional, defauls it 'no', input filter]
Set dropna to 'any' to have records dropped that have NA value in any
column, or 'all' to have records dropped that have NA in all
columns. Set to 'no' to not drop any records. The default is 'no'.
--clean
[optional, default is False, input filter]
The 'clean' command will repair a input index, removing duplicate index
values and sorting.
--round_index ROUND_INDEX
[optional, default is None which will do nothing to the index, output
format]
Round the index to the nearest time point. Can significantly improve the
performance since can cut down on memory and processing
requirements, however be cautious about rounding to a very course
interval from a small one. This could lead to duplicate values in
the index.
--skiprows SKIPROWS
[optional, default is None which will infer header from first line, input
filter]
Line numbers to skip (0-indexed) if a list or number of lines to skip at
the start of the file if an integer.
If used in Python can be a callable, the callable function will be
evaluated against the row indices, returning True if the row should
be skipped and False otherwise. An example of a valid callable
argument would be
lambda x: x in [0, 2].
--index_type INDEX_TYPE
[optional, default is 'datetime', output format]
Can be either 'number' or 'datetime'. Use 'number' with index values that
are Julian dates, or other epoch reference.
--names NAMES
[optional, default is None, transformation]
If None, the column names are taken from the first row after 'skiprows'
from the input dataset.
MUST include a name for all columns in the input dataset, including the
index column.
--target_units TARGET_UNITS
[optional, default is None, transformation]
The purpose of this option is to specify target units for unit conversion.
The source units are specified in the header line of the input or
using the 'source_units' keyword.
The units of the input time-series or values are specified as the second
field of a ':' delimited name in the header line of the input or in
the 'source_units' keyword.
Any unit string compatible with the 'pint' library can be used.
This option will also add the 'target_units' string to the column names.
--print_input
[optional, default is False, output format]
If set to 'True' will include the input columns in the output table.
--tablefmt TABLEFMT
[optional, default is 'csv', output format]
The table format. Can be one of 'csv', 'tsv', 'plain', 'simple', 'grid',
'pipe', 'orgtbl', 'rst', 'mediawiki', 'latex', 'latex_raw' and
'latex_booktabs'.