SILO
MetData¶
Bases: glm_met.MetData
Class for meteorological data and its associated metadata.
Used to store meteoroligcal data downloaded from the SILO API.
Attributes:
-
metadata
(
dict
) –Metadata associated with the meteorological data.
-
data
(
pd.DataFrame
) –Meteorological data in a Pandas DataFrame.
Silo¶
Bases: glm_met.GlmMet
Class for retrieving and processing historical meteorological data from the SILO API.
Examples:
>>> import os
>>> import glm_met.silo.silo as silo
>>> s = silo.Silo(
... location=(116.6, -32.17),
... date_range=("20220101", "20220131"),
... met_data=None,
... format="csv",
... comment="rxel",
... username="test@email.com",
... api="data_drill"
... )
>>> s.get_variables(request_settings=None)
>>> s.write_met(path="silo-data")
After successful call to get_variables()
, the met_data
attribute
of the Silo
type object, s
, is a MetData
type object.
This object has two attributes: a metadata dict and a DataFrame of
met data values.
>>> metadata = s.met_data.metadata
>>> met_data_df = s.met_data.data
Initialise object to download data from the SILO API.
Parameters:
-
location
(
Union[int, tuple[float, float]]
) –Station number for the patch point API or latitude and longitude tuple for the drill down grid API.
-
date_range
(
tuple[str, str]
) –Start and end dates for the data retrieval (in "YYYYMMDD" format).
-
met_data
(
Union[None, MetData]
) –Attribute to store meteorological data downloaded from SILO API.
-
comment
(
str
) –String codes representing meteorological variables to download. See list of variables here:
https://www.longpaddock.qld.gov.au/silo/about/climate-variables/
For example,"rxel"
will download rainfall, max temperature, evaporation, and Morton's shallow lake evaporation. -
username
(
str
) –Email address that must be provided.
-
api
(
str
) –Either "drill_down" for the retrieving point-like data from the gridded SILO product or "patch_point" for station data.
convert_to_glm()
¶
Convert weather data to GLM format.
get_variables(request_settings)
¶
Get variables from the SILO API and store them
in the met_data
attribute.
Parameters:
-
request_settings
(
Union[None, dict]
) –Dictionary object of extra settings to pass in as query parameters to the SILO API.
write_glm_met()
¶
Save weather data in GLM format.
write_met(path)
¶
Save meteorological data and its metadata to a zip file.
Parameters:
-
path
(
str
) –Path to the directory where the zip file should be saved.