Skip to content

Commit

Permalink
Detect missing coords.
Browse files Browse the repository at this point in the history
  • Loading branch information
ways committed Jan 4, 2024
1 parent 3ce0f46 commit 8a4bc64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/routes/collections_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def create_collection(collection_id: str = "", instance_id: str = "") -> dict:
# Get posision in default instance
position=edr_pydantic.data_queries.EDRQuery(
link=edr_pydantic.data_queries.EDRQueryLink(
href=f"{collection_url}position/",
href=f"{collection_url}position",
rel="data",
variables=edr_pydantic.variables.Variables(
query_type="position",
Expand Down
8 changes: 6 additions & 2 deletions app/routes/position_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,17 @@ def check_coords_within_bounds(ds: xr.Dataset, point: Point) -> Tuple[bool, str]
return True, ""


@router.get("/collections/isobaric/position")
async def create_isobaric_page(coords: str) -> dict:
@router.get("/collections/isobaric/position/")
async def create_isobaric_page(request: Request, coords: str = "") -> dict:
"""Position.
This is the main function of this API. Needs a string with the coordinates, and will return data for the nearest point.
"""
if len(coords) == 0:
return {
"body": f'Error: No coordinates provided. Example: {str(request.base_url)[0:-1]}{request.scope["path"]}?coords=POINT(11 59)'
}
return create_point(coords=coords)


Expand Down

0 comments on commit 8a4bc64

Please sign in to comment.