-
Notifications
You must be signed in to change notification settings - Fork 11
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
Should all grid attributes potentially found in files loaded by a Run object be required to be accessible to Model objects? #187
Comments
Totally agree. And your suggested fix looks good to me.
I agree. This raises the question of why have model grid files and attributes at all. But they are in fact useful, e.g. to remove miniscule coordinate value differences across runs. |
I fully agree. It's also quite helpful to have in the case of grid attributes that cannot be found in output files that contain variables (like the |
Fixes spencerahill#187 Previously an error would be raised if a grid attribute found in a Run object did not exist in the Run's corresponding Model. This allows aospy to use grid attributes found only in Run objects.
Currently if a grid attribute that can be found in a Run object cannot be found in a Model object, aospy crashes, because
numpy.allclose
cannot compare an array andNone
. (For example ifzsurf
is represented in a file loaded in by a Run object, but it does not exist in any of the Model grid files).I don't think this should be the desired behavior. I don't see any reason why one should not use a coordinate that is defined in data read in using a Run object that doesn't exist in the Model object.
A simple fix would be to just add an additional condition to line 278 in
aospy.calc._add_grid_attributes
to make sure thatmodel_attr is not None
:@spencerahill what do you think? This came up in adapting aospy to use WRF output. I know historically we both have provided sample data files to each Model object we use (so this hasn't come up before), but now that we have enabled preprocessing functions (which do not get called on Model grid files, and I think this should remain this way) that often change or add coordinates, providing a sample data file to the Model object to fill out its grid attributes doesn't always make sense.
The text was updated successfully, but these errors were encountered: