weather
csv_to_weather(csv_data, node_column='nodes', step_column='steps', weather_columns=None, attributes=None, weather_dir=None, weather_file_names=None)
Convert a dataframe or csv file, containing node, step and weather columns, into a weather set and corresponding weather files, if weather dir is specified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
csv_data
|
Union[str, Path, DataFrame]
|
Dataframe or a csv file path, containing weather data. |
required |
node_column
|
str
|
(Optional) Column containing node ids. The default is "nodes". The default is "nodes". |
'nodes'
|
step_column
|
str
|
(Optional) Column containing node index for weather time series values. The default is "steps". |
'steps'
|
weather_columns
|
Dict[WeatherVariable, str]
|
(Optional) Dictionary of weather variables (keys) and weather column names (values). Defaults are WeatherVariables values are used: "airtemp", "humidity", "rainfall", "landtemp". |
None
|
attributes
|
WeatherAttributes
|
(Optional) Weather attribute object containing metadata for WeatherMetadata object. |
None
|
weather_dir
|
Union[str, Path]
|
(Optional) Directory where weather files are stored. If not specified files are not created. |
None
|
weather_file_names
|
Dict[WeatherVariable, str]
|
(Optional) Dictionary of weather variables (keys) and weather .bin file names (values). |
None
|
Returns:
| Type | Description |
|---|---|
WeatherSet
|
WeatherSet object. |
Source code in emodpy_malaria/weather/__init__.py
generate_weather(platform, site_file, start_date, end_date=None, node_column='nodes', lat_column='lat', lon_column='lon', id_reference=None, request_name='', local_dir=None, data_source=None, force=False)
Generate weather files by submitting a request and downloading generated weather files to a specified dir.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
platform
|
Union[str, COMPSPlatform]
|
Platform name (like "Calculon") or COMPSPlatform object, where the work item will run. |
required |
site_file
|
Union[str, Path]
|
CSV (.csv) or demographics (.json) file containing a set of sites (points) defined with lat/lon. CSV file must contain columns for: EMOD node ids (node), latitude (lat) and longitude (lon). Demographics file must match EMOD demographics file schema. |
required |
start_date
|
int
|
Start date, in formats: year (2018), year and day-of-year (2018001) or date (20180101) |
required |
end_date
|
int
|
(Optional) End date, in formats: year (2018), year and day-of-year (2018365) or date (20181231) |
None
|
node_column
|
str
|
(Optional) Name of a column containing EMOD node ids. The default is "nodes". |
'nodes'
|
lat_column
|
str
|
(Optional) Name of a column containing site (point) latitude. The default is "lat". |
'lat'
|
lon_column
|
str
|
(Optional) Name of a column containing site (point) longitude. The default is "lon". |
'lon'
|
id_reference
|
str
|
(Optional) Value of weather metadata IdReference attribute. The default is "Default". |
None
|
request_name
|
str
|
(Optional) Name to be used for the weather SSMT work item. |
''
|
local_dir
|
Union[str, Path]
|
(Optional) Local dir where files will be downloaded. |
None
|
data_source
|
str
|
(Optional) SSMT data source to be used. |
None
|
force
|
bool
|
(Optional) Flag ensuring a new weather request is submitted, even if weather files exist in "local_dir". |
False
|
Returns:
| Type | Description |
|---|---|
WeatherRequest
|
Can be used to access asset collection id or a local dir (if not given as ) argument or a download report. |
Source code in emodpy_malaria/weather/__init__.py
weather_to_csv(weather_dir, weather_file_prefix='', weather_file_names=None, csv_file=None, node_column='nodes', step_column='steps', weather_columns=None)
Convert weather files into a dataframe and a .csv file, if csv file path is specified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weather_dir
|
Union[str, Path]
|
Local dir containing weather files. |
required |
weather_file_prefix
|
str
|
(Optional) Weather files prefix, e.g. "dtk_15arcmin" |
''
|
weather_file_names
|
Dict[WeatherVariable, str]
|
(Optional) Dictionary of weather variables (keys) and weather .bin file names (values). |
None
|
csv_file
|
Union[str, Path]
|
(Optional) The path of a csv file to be generated. If not specified csv file is not created. |
None
|
node_column
|
str
|
(Optional) Column containing node ids. The default is "nodes". |
'nodes'
|
step_column
|
str
|
(Optional) Column containing node index for weather time series values. The default is "steps". |
'steps'
|
weather_columns
|
Dict[WeatherVariable, str]
|
(Optional) Dictionary of weather variables (keys) and weather column names (values). Defaults are WeatherVariables values are used: "airtemp", "humidity", "rainfall", "landtemp". |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[DataFrame, WeatherAttributes]
|
Dataframe and weather attributes objects. |