Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer committed Oct 11, 2024
1 parent 6ee9d7a commit 6374273
Show file tree
Hide file tree
Showing 3 changed files with 1,406 additions and 1,281 deletions.
11 changes: 7 additions & 4 deletions docs/examples/minimal_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@

#select a set of parameters
# Filter the locations dataframe with the desired parameters and stations.
bool_stations = locations.index.isin(['IJMDBTHVN', 'DANTZGZD','HOEKVHLD'])
# measured (WATHTE) versus computed/astro
bool_stations = locations.index.isin(['ijmuiden.buitenhaven', 'dantziggat.zuid', 'hoekvanholland', 'ameland.nes'])
# meting/astronomisch/verwachting
bool_procestype = locations['ProcesType'].isin(['meting'])
# waterlevel/waterhoogte (WATHTE)
bool_grootheid = locations['Grootheid.Code'].isin(['WATHTE'])
# timeseries (NVT) versus extremes
bool_groepering = locations['Groepering.Code'].isin(['NVT'])
bool_groepering = locations['Groepering.Code'].isin([''])
# vertical reference (NAP/MSL)
bool_hoedanigheid = locations['Hoedanigheid.Code'].isin(['NAP'])
selected = locations.loc[bool_stations & bool_grootheid &
selected = locations.loc[bool_procestype &
bool_stations & bool_grootheid &
bool_groepering & bool_hoedanigheid]

start_date = dt.datetime(2023, 1, 1)
Expand Down
15 changes: 6 additions & 9 deletions docs/examples/retrieve_parallel_to_netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


def get_data(location, start_date, end_date, dir_output, overwrite=True):

station_id = location.name
station_messageid = location["Locatie_MessageID"]
filename = os.path.join(dir_output, f"{station_id}-{station_messageid}.nc")
Expand Down Expand Up @@ -44,19 +43,18 @@ def get_data(location, start_date, end_date, dir_output, overwrite=True):
ds.to_netcdf(filename, format="NETCDF4_CLASSIC")


if ( __name__ == "__main__" ):

if __name__ == "__main__":
dir_output = './ddl_retrieved_data'
os.makedirs(dir_output, exist_ok=True)

# get locations
locations = ddlpy.locations()
bool_stations = locations.index.isin(['IJMDBTHVN', 'DANTZGZD', 'HOEKVHLD', 'VLISSGN', 'HOEK', 'VLIS', "OLST"])
bool_grootheid = locations['Grootheid.Code'].isin(['WATHTE']) # measured (WATHTE) versus computed/astro
bool_groepering = locations['Groepering.Code'].isin(['NVT']) # timeseries (NVT) versus extremes
bool_stations = locations.index.isin(['ijmuiden.buitenhaven', 'dantziggat.zuid', 'hoekvanholland', 'ameland.nes', 'vlissingen', 'olst'])
bool_procestype = locations['ProcesType'].isin(['meting']) # meting/astronomisch/verwachting
bool_grootheid = locations['Grootheid.Code'].isin(['WATHTE']) # waterlevel (WATHTE)
bool_groepering = locations['Groepering.Code'].isin(['']) # timeseries (NVT) versus extremes
bool_hoedanigheid = locations['Hoedanigheid.Code'].isin(['NAP']) # vertical reference (NAP/MSL)
selected = locations.loc[bool_stations & bool_grootheid & bool_groepering & bool_hoedanigheid]

selected = locations.loc[bool_stations & bool_procestype & bool_grootheid & bool_groepering & bool_hoedanigheid]

start_date = dt.datetime(2022, 1, 1)
end_date = dt.datetime(2022, 3, 1)
Expand All @@ -70,7 +68,6 @@ def get_data(location, start_date, end_date, dir_output, overwrite=True):
for station_code, location in selected.iterrows():
executor.submit(get_data, location, start_date, end_date, dir_output)


file_list = glob.glob(os.path.join(dir_output, "*.nc"))
fig, ax = plt.subplots()
for file_nc in file_list:
Expand Down
Loading

0 comments on commit 6374273

Please sign in to comment.