USACE / cwms-data-api

Corps Water Management System RESTful Data Service
MIT License
13 stars 14 forks source link

Need level-date for Location Level #662

Open inguyen314 opened 5 months ago

inguyen314 commented 5 months ago

I need to extract the location level (Record Stage) level-date.

Here is my SQL statement.

select location_id
    ,location_level_id
    ,level_date
    ,constant_level
    ,level_unit
from CWMS_20.AV_LOCATION_LEVEL
where specified_level_id = 'Record Stage' and location_id = cwms_util.split_text('St Louis-Mississippi.Stage.Inst.30Minutes.0.lrgsShef-rev', 1, '.') and unit_system = 'EN'

The SQL above returns a constant_level = 49.58 and level_date = 01-Aug-93 (these are what i need)

I cannot replicate this with CDA: image

CDA does not return the correct "level-date"? https://water.usace.army.mil/cwms-data/levels/St%20Louis-Mississippi.Stage.Inst.0.Record%20Stage?office=MVS&effective-date=2024-01-01T08:00:00&unit=ft

This is the payload i'm seeing from CDA:

 "office-id": "MVS",
  "location-level-id": "St Louis-Mississippi.Stage.Inst.0.Record Stage",
  "seasonal-values": [],
  "constant-value": 49.58,
  "level-units-id": "ft",
  "level-date": "2024-01-01T08:00:00Z",
  "interval-months": 0,
  "interval-minutes": 0,
  "attribute-units-id": "ft"
curl -X 'GET' \
  'https://cwms-data.usace.army.mil/cwms-data/levels/St%20Louis-Mississippi.Stage.Inst.0.Record%20Stage?office=MVS&effective-date=2024-05-23T00%3A00&unit=ft' \
  -H 'accept: application/json;version=2'

thanks

rma-rripken commented 5 months ago

This issue needs to be revisited in more depth but I noticed that the getOne and getAlll end-points currently go thru some slightly different logic and the getAll appears to return the date you want but it might only work for SI until servers are updated.