Skip to content

Commit

Permalink
Feat: return all available observations from an area or position if p…
Browse files Browse the repository at this point in the history
…arameter names are not given
  • Loading branch information
fjugipe committed Feb 7, 2024
1 parent 13961d4 commit 5cee99e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/routers/edr.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async def get_data_location_id(
)
async def get_data_position(
coords: str = Query(..., example="POINT(5.179705 52.0988218)"),
parameter_name: str = Query(..., alias="parameter-name", example="dd,ff,rh,pp,tn"),
parameter_name: str = Query(None, alias="parameter-name", example="dd,ff,rh,pp,tn"),
datetime: str | None = None,
f: str = Query(default="covjson", alias="f", description="Specify return format."),
):
Expand All @@ -107,15 +107,17 @@ async def get_data_position(
)
async def get_data_area(
coords: str = Query(..., example="POLYGON((5.0 52.0, 6.0 52.0,6.0 52.1,5.0 52.1, 5.0 52.0))"),
parameter_name: str = Query(..., alias="parameter-name", example="dd,ff,rh,pp,tn"),
parameter_name: str = Query(None, alias="parameter-name", example="dd,ff,rh,pp,tn"),
datetime: str | None = None,
f: str = Query(default="covjson", alias="f", description="Specify return format."),
):
poly = wkt.loads(coords)
assert poly.geom_type == "Polygon"
range = get_datetime_range(datetime)
get_obs_request = dstore.GetObsRequest(
filter=dict(instrument=dstore.Strings(values=list(map(str.strip, parameter_name.split(","))))),
filter=dict(
instrument=dstore.Strings(values=list(map(str.strip, parameter_name.split(","))) if parameter_name else "*")
),
inside=dstore.Polygon(points=[dstore.Point(lat=coord[1], lon=coord[0]) for coord in poly.exterior.coords]),
interval=dstore.TimeInterval(start=range[0], end=range[1]) if range else None,
)
Expand Down

1 comment on commit 5cee99e

@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%23–68
datastore_pb2_grpc.py43430%2–225
dependencies.py22220%1–33
grpc_getter.py880%1–16
locustfile.py15150%1–31
main.py22220%3–51
metadata_endpoints.py19190%1–70
formatters
   \_\_init\_\_.py12650%16–32
   base_formatter.py7186%18
   covjson.py52198%69
routers
   \_\_init\_\_.py00100% 
   edr.py47470%2–126
   records.py00100% 
test
   test_covjson.py600100% 
TOTAL36523037% 

API Unit Test Coverage Summary

Tests Skipped Failures Errors Time
4 0 💤 0 ❌ 0 🔥 0.917s ⏱️

Please sign in to comment.