Skip to content
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

Update get_onc_ctd and get_onc_ferry workers to work with ONC API v3 #234

Merged
merged 13 commits into from
Feb 29, 2024

Conversation

douglatornell
Copy link
Member

No description provided.

Replace unittest.mock.patch decorator with pytest.fixture for mock worker.

Add unit tests for production YAML config file elements related to worker;
re: issue #117.

Replace unittest.mock.patch decorator with pytest caplog fixture for tests of
logging; re: issue #82.
Added unit test for production YAML configuration file ctd data observations
elements used in after_* () functions.
@douglatornell douglatornell added bug Something isn't working Workers labels Feb 3, 2024
@douglatornell douglatornell added this to the v24.1 milestone Feb 3, 2024
Update docstring re: issue #121.

Return worker so that modernized unit tests for main() work; re issue #81.
Copy link

codecov bot commented Feb 3, 2024

Codecov Report

Attention: Patch coverage is 84.11215% with 17 lines in your changes are missing coverage. Please review.

Project coverage is 77.72%. Comparing base (2920ddb) to head (2df8de1).
Report is 6 commits behind head on main.

Files Patch % Lines
nowcast/workers/get_onc_ferry.py 15.00% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
+ Coverage   77.65%   77.72%   +0.06%     
==========================================
  Files         133      133              
  Lines       18705    18758      +53     
  Branches     1900     1900              
==========================================
+ Hits        14526    14580      +54     
+ Misses       4113     4112       -1     
  Partials       66       66              
Flag Coverage Δ
unittests 77.72% <84.11%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Modified the get_onc_ctd worker to use ONC API v3 'getByLocation' method. The
new method uses a location code instead of a station name. Also, these changes
include adding a 'dateTo' parameter to limit the data to a specific time range
for the day. Additionally, small changes to variable and parameter names were
made to match the new method requirements.
The pytest skip marker for "_resample_nav_coord()" function in
"tests/workers/test_get_onc_ferry.py" file has been removed. This has happened
following the successful resolution of issue number #174, making it unnecessary
to skip these specific unit tests anymore.

Fixes issue #174
Add unit tests for production YAML config file elements related to worker;
re: issue #117.
The 'nowcast.yaml' configuration file has been updated to include the
Tsawwassen - Duke Point ferry route details including devices, sensors,
and other relevant data.
The dataset ID for TWDP-ferry was updated in the 'nowcast.yaml' configuration
file and in respective test. The change is reflected accurately to match the
new details for the Tsawwassen - Duke Point ferry route.
Modified the get_onc_ferry worker to use ONC API v3 'getByLocation' method. The
new method uses a location code instead of a station name. Also, these changes
include adding a 'dateTo' parameter to limit the data to a specific time range
for the day. Server-side averaging into 1-second bins is used to ensure that an
entire day's observations from each sensor can be obtained by a single API
request; there is a limit of 100,000 "rows" per sensor. Additionally, small
changes to variable and parameter names were made to match the new method
requirements.
Updated the ONC_data_product_url attribute in the datasets produced by the
get_onc_ferry worker to reflect changes in the data source's domain name and API
query parameter names. Code changes include updating the ONC data API domain
name, adding the 'locationCode' query parameter, and changing the
'deviceCategory' query parameter name to 'deviceCategoryCode'. All of those
changes are for compatibility with the ONC data API v3.
Changed the naming representation of the relative humidity attribute in the
'get_onc_ferry' worker. The attribute was initially named "REL_HUMIDITY" and it
was renamed to "rel_humidity", matching the common low-caps format of the other
attributes for consistency of naming convention.
Adjust the QA/QC filter settings in the 'get_onc_ferry' worker to now include
data where the 'qaqcFlag' attribute is less than or equal to 1 or greater than
or equal to 7. This update is necessary because of the change to server-side
averaging in the request.
ONC API v3 has more/different ways of returning empty responses to data requests
that we have to handle. It's not as clean as I would like, but it is good
enough for the purpose.
@douglatornell douglatornell merged commit 2749570 into main Feb 29, 2024
7 checks passed
@douglatornell douglatornell deleted the onc-api-v3 branch February 29, 2024 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Workers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant