Skip to content

Commit

Permalink
Update level, period and function field
Browse files Browse the repository at this point in the history
  • Loading branch information
Teddy-1000 committed Feb 21, 2024
1 parent 8d074b2 commit a1d3f69
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions datastore/data-loader/client_knmi_station.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,31 @@ def netcdf_file_to_requests(file_path: Path | str) -> Tuple[List, List]:
for param_id in knmi_parameter_names:
# print(station_id, param_id)
param_file = station_slice[param_id]
standard_name, level, function, period = (
generate_parameter_name(
(param_file.standard_name if "standard_name" in param_file.attrs else "placeholder"),
"2.0",
param_file.long_name,
param_id,
),
)

ts_mdata = dstore.TSMetadata(
platform=station_id,
instrument=param_id,
title=param_file.long_name,
standard_name=param_file.standard_name if "standard_name" in param_file.attrs else None,
standard_name=standard_name,
unit=param_file.units if "units" in param_file.attrs else None,
level="2.0",
period="PT10M",
function="mean",
parameter_name=generate_parameter_name(
param_file.standard_name if "standard_name" in param_file.attrs else "placeholder",
"2.0",
param_file.long_name,
param_id,
),
level=level,
period=period,
function=function,
parameter_name="_".join([standard_name, level, function, period]),
)

for time, obs_value in zip(pd.to_datetime(param_file["time"].data).to_pydatetime(), param_file.data):
for time, obs_value in zip(
pd.to_datetime(param_file["time"].data).to_pydatetime(),
param_file.data,
):
ts = Timestamp()
ts.FromDatetime(time)
if not math.isnan(obs_value): # Stations that don't have a parameter give them all as nan
Expand Down Expand Up @@ -94,7 +101,7 @@ def generate_parameter_name(standard_name, level, long_name, instrument):
else:
period = "PT0S"

return "_".join([standard_name, level, function, period])
return standard_name, level, function, period


def insert_data(observation_request_messages: List):
Expand Down

1 comment on commit a1d3f69

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API Unit Test Coverage Report
FileStmtsMissCoverMissing
\_\_init\_\_.py00100% 
datastore_pb2.py584621%24–69
datastore_pb2_grpc.py432347%37–52, 85–87, 92–94, 99–101, 106–108, 112–136, 174, 191, 208, 225
dependencies.py481667%26–27, 34, 41, 62–69, 77–84
grpc_getter.py13838%12–15, 19–22
locustfile.py15150%1–31
main.py22386%27, 37, 47
metadata_endpoints.py19479%17, 34–67, 71
formatters
   \_\_init\_\_.py70100% 
   covjson.py46687%58, 65–69, 73–76
routers
   \_\_init\_\_.py00100% 
   edr.py671184%38–63, 143–144, 188–189, 205
   records.py00100% 
TOTAL33813261% 

API Unit Test Coverage Summary

Tests Skipped Failures Errors Time
16 0 💤 8 ❌ 0 🔥 4.208s ⏱️

Please sign in to comment.