-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BiG-CZ: Fetch CUAHSI Values using WaterML and Ulmo #2353
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ulmo (https://github.com/ulmo-dev/ulmo/) is a data access library designed to fetch information from various hydrology and climatology sources. It works on the WaterML standard, which is a protocol built on top of SOAP. We will use it to fetch detailed values for sensor data from CUAHSI. Also upgrade pip which speeds up our Python dependency installation step significantly.
Previously, a CUAHSI search would have a `concept_keywords` array of strings, corresponding to each variable. Now that we want to fetch more detailed values, we switch to having an array of `variables`, each of which in addition to `id`, `name` (that tends to be longer, more like a description than name), and `concept_keyword`, has a `site` and `wsdl` which will be used to fetch values for that variable in a given timespan. This array is sorted by `concept_keyword`, which will also be used as a display label in the UI.
For fetching CUAHSI variable values, we add two endpoints: `details` expects a `wsdl` and `site` parameter, and uses it to fetch the WaterML siteinfo object for the given site from the given wsdl url. This siteinfo object contains details for the variables in the site, including units, and the time ranges for which each variable has values. This information is important, because if we query for `values` with a time outside this range, the endpoint crashes. `values` expects a `wsdl`, `site`, `variable`, `from_date` and `to_date`, and uses it to fetch the values of that variable at that site in the given time range, and returns the WaterML value object. The expected use is one call to `details` for a site, to fetch units and time ranges for each variable, and then a call to `values` for each variable in the site, fetching its values for the given time range. --- Notes: 1. The WaterML objects themselves are complex and elaborate, with many nested keys and arrays. Fortunately, we don't need to write our own serializers for them, because that is all taken care of within Ulmo. Furthermore, because of WaterML being an underlying standard, we can reasonably expect the data to follow a certain shape, and exercise this assumption all the way on the client side, without having to verify it on the server. 2. Ulmo uses suds under the hood to make SOAP requests, and by default uses the suds cache, which is distinct from the redis cache used elsewhere in the app (for Geoprocessing, etc). I have not looked into changing this default behavior, leaving it to a future investigation should the need arise.
This was referenced Oct 9, 2017
arottersman
approved these changes
Oct 9, 2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, was able to test with a variety of NWISGW
sites. NWISDV
sites like 01467200
weren't going so well, but as you said in person, it's probably the underlying API, not us.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Adds Ulmo, and uses it in Django endpoints for fetching CUAHSI details and values.
The expected usage is:
/bigcz/details
to fetch general information about all variables in a site/bigcz/values
for each variable to fetch its valuesUI for this is coming in a following PR. The UI may be broken until that next PR is merged.
See commit messages for details.
Connects #2243
Connects #2238
Demo
Details
Values
Notes
The WaterML objects themselves are complex and elaborate, with many nested keys and arrays. Fortunately, we don't need to write our own serializers for them, because that is all taken care of within Ulmo. Furthermore, because of WaterML being an underlying standard, we can reasonably expect the data to follow a certain shape, and exercise this assumption all the way on the client side, without having to verify it on the server.
Ulmo uses suds under the hood to make SOAP requests, and by default uses the suds cache, which is distinct from the redis cache used elsewhere in the app (for Geoprocessing, etc). I have not looked into changing this default behavior, leaving it to a future investigation should the need arise.
Testing Instructions
Check out this branch, and reprovision
app
andworker
:Go to a sample details endpoint and ensure it populates
Go to a sample values endpoint and ensure it populates