grat.reports.converters
¶
This module contains functions for converting day of water year to month name and summing daily values by month.
get_month_name
¶
Get the month name from a day of the water year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
water year |
required |
day_of_water_year
|
int
|
The day of the water year (1-365 or 1-366 for a leap year). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
The name of the month corresponding to the input day of the water year. |
Source code in src/grat/reports/converters.py
get_num_days_in_month
¶
Get the number of days in a given month of a given water year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The year. |
required |
month_name
|
str
|
The name of the month (e.g., "January", "February", etc.). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
The number of days in the given month of the given year. |
Source code in src/grat/reports/converters.py
is_leap_year
¶
Determine whether a year is a leap year or not.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The year to check. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
True if the year is a leap year, False otherwise. |
Source code in src/grat/reports/converters.py
find_wy_month_index
¶
Returns the index position of the months in the order of the water year (starts in october).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
month_name
|
name of the month |
required |
Returns: index position of the month (oct -> sept) in the water year
Source code in src/grat/reports/converters.py
sum_array_by_month
¶
Slices an array of daily values into months and sums each one.
The months are water-year months, so the first entry of the returned list is
October and the last is September. Reports 06 and 07 label these sums 1 to 12,
which means their column "1" holds October, not January.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
daily_values
|
daily values ordered by day of the water year |
required | |
leap_year
|
whether this water year has 366 days |
False
|
Returns:
| Type | Description |
|---|---|
|
A list of 12 monthly sums, October first |