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

Handle climo files with separate chronology #60

Merged
merged 14 commits into from
Aug 15, 2017

Conversation

rod-glover
Copy link
Contributor

@rod-glover rod-glover commented Jul 25, 2017

Fixes #57

The fix itself was simple. Modifying the tests to replace completely non standards-compliant test files cgcm.nc and cgcm-tmin.nc with standards compliant ones took most of the work.

.filter(TimeSet.time_resolution == timescale)

.filter(DataFileVariable.ensembles.any(Ensemble.name == ensemble_name))
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I grouped related joins and filters, but this may not seem to others, as it does to me, a clearer way to organize the query.

@rod-glover rod-glover force-pushed the issue57-api-data-split-climos branch from 30f2b2c to a1b862c Compare July 25, 2017 21:46
@corviday
Copy link
Contributor

corviday commented Jul 25, 2017

     Searches the database for all files from a given model and
     emission scenario and returns a data value for that particular
     timestep (e.g. January [1], summer [14] or annual [17]) in each
     file.

Maybe I'm misunderstanding how this query works now, but I think this docstring in data.py could use an update. You'd now pass 0 for January (with timescale=monthly), 2 for summer (with timescale=seasonal) and 0 for annual (with timescale=yearly)? Am I understanding that correctly?

@corviday
Copy link
Contributor

corviday commented Jul 26, 2017

Seems to produce plausible data and accept the specified inputs. Looks good to me.
screenshot from 2017-07-25 17-00-18

('seasonal', 2, (1985, 7, 15)),
('yearly', 0, (1985, 7, 2)),
))
def test_data_single_file(populateddb, variable,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we do any exception testing here? E.g. what happens if you give time_idx=1 for timescale='yearly', etc.?

Copy link
Contributor

@corviday corviday Jul 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's what happens at present.

The frontend data validation functions check to see (line 93) if the backend returns a string object instead of a JSON object to catch that sort of thing.

There may be a better way to deal with this, but that's what happens now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes, yeah we definitely want to avoid the backend returning 500s!

Copy link
Contributor

@jameshiebert jameshiebert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rod-glover rod-glover merged commit 61c16e2 into master Aug 15, 2017
@rod-glover rod-glover deleted the issue57-api-data-split-climos branch August 15, 2017 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data API call doesn't handle split climatology files
3 participants