Conversation
|
Thank you so much for adding this @rwegener2. I think we need to clearly define what we want this implementation to do. Under which circumstances will a I think one major thing to check is if the axes are correctly detected. We 'know' the association between axes and dimensions roughly: def test_cf_axes(ds):
ds_preprocessed = combined_preprocessind(ds)
for dim, axis in [('x', 'X'), ('y', 'Y'), ('lev','Z'), ('time', 'T')]:
if dim in ds_preprocessed.dims:
#check that the axis is in the cf object
axis in ds_preprocessed.cf.axes.keys()You can create a bunch of test cases in the normal tests under https://github.com/jbusecke/cmip6_preprocessing/blob/master/tests/test_preprocessing.py, but I think this would be REALLY useful to check in the cloud tests , because that would enable us to actually see which models fail and why.
I think I would prefer a seperate function like |
|
Nice work @rwegener2 . The I think you'll want to write a test like @jbusecke suggested. These are the attributes that |
|
Thanks for the feedback on this. I apologize for taking so insanely long to respond - I wasn't working on any development in August - but I am settled back in so I can be much more responsive going forward. I updated the As for the cloud test, I added the same chunk of testing code into the I'm sorry again for the long delay and let me know if there is anything else that should be changed. |
I think you want to avoid this. It adds units which could be totally wrong. You can skip that with |
|
Thanks for the feedback @dcherian. I just removed that so that only |
|
Hey everyone, I am very sorry for dropping the ball here. I should have a bit more capacity to maintain cmip6_pp going forward. Is this still of interest? Would be happy to help to move this along. |
|
Hey @jbusecke! If you think this is a helpful addition to the project I'm happy to put some energy to get it merged. I just pushed a superficial change to trigger the checks again because the previous failure logs got deleted with inactivity. I don't remember seeing much in the logs that made sense to me, but if you know what I should do to get the test to pass just let know. Thanks, Julius! |
|
I think I will dedicate some time to cmip6_pp in 1-2 weeks. How about I ping this issue then and we can iterate on it? I still believe this would be a great addition. |
|
Sounds good, I'll keep an eye out! |
What was done
This PR adds the
.cf.guess_coord_axis()and.cf.add_canonical_attributes()functions to thepreprocessingcomponent of the library. This will update the dataset with additional attributes in line with CF conventions that can be inferred by thecf_xarraylibrary.See: Issue #185
How it was done
Two lines were added to the
rename_cmip6function:I put them in the
rename_cmip6function inpreprocessing.pybecause it seemed to semantically fit, but I'm certainly open to moving them if there's a better spot.Testing
I added an additional assertion to the
test_rename_cmip6function intest_preprocessing.py. The test is weak mostly because there isn't a lot that is guaranteed to be true after running the additional steps here. The one check I added (because I believe it should always be true) is thathistoryis present in the global attributes. I could certainly be convinced that this in unnecessary and the test should be removed.WIP
This is a Work In Progress because I actually can't get the test to pass (😱). When I use my local version of the library it works just fine so I'm not sure why the tests are working. I thought I'd still post this, though, since the necessity of the test is questionable, before spending oodles of time debugging it.
Seeing the test problem
Personally I ran my tests with
python -m pytest .in my conda activated environment.This PR has a slightly annoying number of print statements, which I left in to help demonstrate how it seems that the preprocessing file is correctly using the new lines of code but (at least for me) the tests aren't. I print the dataset keys in both the preprocessing file and the test file to show the error.
Code I use to manually test, since the regular test is failing