NASA POWER
MetData¶
Bases: glm_met.MetData
Class for meteorological data and its associated metadata.
Used to store meteoroligcal data downloaded from the NASA POWER API.
Attributes:
-
metadata
(
dict) –Metadata associated with the meteorological data.
-
data
(
pd.DataFrame) –Meteorological data in a Pandas DataFrame.
NASA POWER¶
Bases: glm_met.GlmMet
Class for retrieving and processing meteorological data from the NASA POWER API.
Initialises a Power object retrieving and storing
meteorological data from NASA POWER's API.
Parameters:
-
location
(
tuple[float, float]) –Latitude and longitude of the location for the data retrieval.
-
date_range
(
tuple[str, str]) –Start and end dates for the data retrieval (in ISO 8601 format, e.g., "YYYY-MM-DD").
-
met_data
(
Union[None, MetData]) –Attribute to store meteorological data downloaded from open-meteo.
-
glm_met_data
(
Union[None, pd.DataFrame]) –Attribute to store meteorological data downloaded from open-meteo in GLM format.
-
parameters
(
Union[None, list[str]]) –List of meteorological variables to retrieve. The default is to use the list specified in
settings.hourly_glm_default. -
timezone
(
str) –LST - local solar time or UTC.
-
community
(
str) –SBfor sustainable buildings andAGfor agroclimatology.
convert_to_glm()
¶
Convert hourly meteorological data to GLM format
and store it in the glm_met_data attribute.
This function only works with hourly data, this method expects the
met_data.data attribute of the Power object to have the
following variables: "ALLSKY_SFC_SW_DWN", "CLOUD_AMT", "T2M", "RH2M",
"WS2M", "PRECTOTCORR".
If the data in met_data.data has different
variables, you will need to write your own function to convert the data
to GLM format.
CLOUD_AMT from NASA POWER is in percentage units. GLM requires it as
a proportion (0.0 to 1.0).
precipitation is in mm. GLM requires it in m / day even if
using hourly data, so it is converted.
get_variables(request_settings)
¶
Get variables from the NASA POWER hourly API and store them
in the met_data attribute.
If you need to pass in extra settings to the API, pass these into
the get_variables() method as a dict object. These settings will
be appended to the API request as query parameters.
Parameters:
-
request_settings
(
Union[None, dict]) –Dictionary object of extra settings to pass in as query parameters.
write_glm_met(path, zip_f, fname)
¶
Save meteorological data in GLM format and its metadata to file.
Only works after a call to convert_to_glm() and with hourly
data.
Parameters:
-
path
(
str) –Path to the directory where the zip file should be saved.
-
zip_f
(
bool) –Whether to save output to a zip file.
-
fname
(
str) –If zip_f is
True, filename for GLM meteorological data csv.
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.