-
Notifications
You must be signed in to change notification settings - Fork 12
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
Warn or raise when needed DataLoader attributes aren't included #136
Comments
Agreed, that is a bad error message |
Hey @spencerahill TLDR - I couldn't get the loader to work with GDFL data from Details: I tried loading in files related to the variable Here are the paths that that the loader generated, and threw an error with:
This is pretty close to format of this GDFL post-processed data, but not quite. e.g.: the loader expected Am I doing something wrong? (That could totally be what's going on! :) Here is what I tried: https:/haydenbetts/aospy-run-test) Is this post-processed data from AM 2.1 out of scope for the GFDLDataLoader? If so, where can I find in-scope data? |
You're not doing anything wrong, as indeed the filenames for the data you found doesn't match the pattern we have built the GFDLDataLoader around. Here is another example. Presumably both of these are for model data that was ultimately intended for the CMIP archives, based on the fact that they use the CMIP standard variable names rather than GFDL's in-house standard names, i.e. I'm sure there is some publicly available GFDL data in the proper format, but I can't find any right now; in fact many of the links from the GFDL data portal page seem broken. @spencerkclark, do you have any on hand? Also, @spencerkclark wrote the unit tests e.g. here that cover the GFDLDataLoader, but AFAICT those tests generate the needed objects and data for the tests as they run. So another option is to try to do something similar. In fact, since this (like all new code) will require unit tests of its own, this ultimately might be the best way to proceed...i.e. you'll have to do it sooner or later. In other words, maybe don't worry about finding test data in the wild matching the pattern: just construct it like those existing unit tests have. Also, thanks for describing the problem very clearly, which is really helpful. |
@haydenbetts thanks for your interest; sorry for being silent for a bit. I agree with @spencerahill regarding thinking about this problem in a more abstract sense, i.e. without worrying about having actual example files, as that will be useful for writing tests. In this case I think you might not need to worry about filenames. For testing you might be able to create GFDLDataLoaders with and without the required input arguments and make sure an error is raised under the appropriate circumstances. Nevertheless, for your reference, I put up a small set of files in the form of a tar archive on Google Drive that fit this directory/naming structure in case you'd like to try things out in a practical setting. |
It is possible to instantiate a GFDLDataLoader that doesn't include all of the attributes (e.g. data_dur) that are ultimately required to find the file. Currently, we don't warn or raise when this happens.
This leads to non-intuitive crashes. E.g. when I try a calculation using a Run whose data_loader mistakenly didn't have a data_dur attribute, I get this traceback, which is coming from the fact that
data_dur
is None:I don't want to switch to positional arguments, but I think we should at the very least warn when the needed attributes are missing. Maybe raising is too much, since then a user won't even be able to import their object library -- it might be more user-friendly to warn, so that they can use other objects but also know that this particular object will fail if they try to use it.
The text was updated successfully, but these errors were encountered: