Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Add meteostat tool (#1180)
Browse files Browse the repository at this point in the history
  • Loading branch information
dchassin committed Jun 15, 2022
1 parent b4b91e0 commit f8dcd35
Show file tree
Hide file tree
Showing 9 changed files with 1,681 additions and 3 deletions.
45 changes: 45 additions & 0 deletions docs/Utilities/Meteostat_weather.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[[/Utilities/Meteostat_weather]] - Meteostat weather access

# Synopsis

Shell:

~~~
$ python3 meteostat.py [OPTIONS] ...
~~~

GLM:

~~~
#python3 meteostat.py [OPTIONS] ...
~~~

Options:

- `-h|--help|help`: Get this help information (exits with code 0)

- `-c|--csv=CSVNAME`: Name the CSV output file (optional)

- `-g|--glm=GLMNAME`: Name the GLM output file (optional)

- `-n|--name=OBJNAME`: Name the weather object (optional)

- `-p|--position=LAT,LON`: Specify the location (required)

- `-s|--start=YYYY-MM-D`D: Specify the start date (optional)

- `-e|--end=YYYY-MM-DD`: Specify the end date (optional)

# Description

The `meteostat_weather` tool gathers data from the Meteostat website and converts it
to a GridLAB-D weather object. If neither `CSVNAME` or `GLMNAME` are provided the weather
data is written to stdout. Otherwise, the default `CSVNAME` is `meteostat_ID.csv` where
`ID` is the station identifier provided by Meteostat. The default weather object is
also named `meteostat_ID`. If the start date and/or end date are not specified, then
the default is all available data.

# See also

* [https://dev.meteostat.net/]

15 changes: 12 additions & 3 deletions module/climate/weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,18 @@ weather::weather(MODULE *module)

EXPORT int create_weather(OBJECT **obj, OBJECT *parent)
{
weather *my = (weather*)(obj+1);
my->next = NULL;
return 1; // don't want it to get called, but better to have it not be fatal
*obj = gl_create_object(weather::oclass);
if ( *obj != NULL )
{
weather *my = OBJECTDATA(*obj,weather);
gl_set_parent(*obj,parent);
my->next = NULL;
return 1;
}
else
{
return 0;
}
}

/// Synchronize the cliamte object
Expand Down
1 change: 1 addition & 0 deletions tools/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dist_pkgdata_DATA += tools/insights.py
dist_pkgdata_DATA += tools/market_data.py
dist_pkgdata_DATA += tools/mdb_info.py
dist_pkgdata_DATA += tools/market_model.py
dist_pkgdata_DATA += tools/meteostat_weather.py
dist_pkgdata_DATA += tools/metar2glm.py
dist_pkgdata_DATA += tools/noaa_forecast.py
dist_pkgdata_DATA += tools/nsrdb_weather.py
Expand Down
Loading

0 comments on commit f8dcd35

Please sign in to comment.