-
Notifications
You must be signed in to change notification settings - Fork 20
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
Error in cf.write when writing UM data fields #838
Comments
Hi Ella, sorry you've run into this - from the traceback it looks like a bug (in our upstream library |
Hi Sadie, thanks for the response - nice to know it's not me doing something silly for once. Here's the output from cf.environment:
|
Excellent. thanks for the report. (Sorry for a bit of a delay in replying, we are really quite busy right now including preparing for these new releases, but if this is as suspected a bug the fix should go into the new releases.) Looking into it now and will report back today. |
OK I have tried to recreate this with various data locally but I can't - as per the traceback, in the logic somehow a dictionary object is being placed into Please can you run |
Thanks for investigating this. This is the output of f[0].dump() when I read one of the files in and make no changes to the attributes:
|
Thanks. Hmmm, everything looks fine there with that dump output. I see you are working on JASMIN - would you be able to share the (accessible) path on JASMIN of an example dataset which runs into this issue with me? That would be the quickest way for us to work out what's up here, given I'm struggling to recreate the issue which clearly only happens when certain conditions are met that I can't yet foresee (there's nothing in the code logic that showcases an obvious issue). Else share an example dataset by some other means - happy to take an email or if it is small enough, you could share here via comment? |
Oh that's annoying! Thanks for digging into it for me. I have put an example file in https://gws-access.jasmin.ac.uk/public/polarres/debug/ |
Ah perfect, thanks. OK so on the same environment (at least, version0wise) I can read that in and write it back out without issue, so this implies it is something you are doing to the file to process it which is leading to the issue, ultimately. Not to say that you are doing anything wrong per se, you could be doing the right thing and there's a bug in cf-python or cfdm whereby we should probably be handling something better, but as yet, not clear. You mention that you have:
so I wonder if somehow you are adding an attrbitute in a way where it ends up being non-CF-compliant, notably somehow a dictionary rather than a list? I remember now that we had a discussion over on the CMS Helpdesk about how to edit attributes (https://cms-helpdesk.ncas.ac.uk/t/renaming-attributes-coordinates-in-cf-python/1526) and that way of doing it should be fine, but obviously something is making the libraries unhappy. Maybe you could trace through your processing code to the last part in which you can still do a successful write? Then we'll know what changes to the field are resulting in the issue? Alternatively if you are happy to send the script you are using I can find that out. Sorry I can't be more helpful here - unless we can recreate an error it's hard to pinpoint what's going on. |
Sorry I didn't see this comment until now - I would understand if there was something I'm doing to the file, but I get the same error if I just load the file and then immediately try to write it again, i.e.
|
Is this definitely the file you have put at the link above, https://gws-access.jasmin.ac.uk/public/polarres/debug/? I'm a bit perplexed, because if I download that, and match your environment as best I can (same version of cf, cfdm, cftime, netCDF4-python, etc.) and I do the same read and immediate write, it all works. Please also check that the environment you are reporting is the one you are actually using, here. I thought, since I'm struggling to recreate, I might as well get onto JASMIN and use JasPy to get the exact same environment (I just used the current with |
Ok I'm not sure what's happening either, because I'm now unable to reproduce the error too... I will have a look at the specific attributes I'm adding in and see if there's something in particular causing the complaint. Thanks for your help so far! |
That's good! Given this along with what I've observed, and if you're sure that is the same file you saw the error on another time, I suspect that when you got the error it was due to something bad that had happened to the environment which meant some other version of something snuck in and the incompatibility caused the problem. Can you continue with what you were doing now, without seeing the issue? If so, I'm happy to go with the theory that somehow your environment was messed up somehow and that there isn't a problem with cf or cfdm, if you are. But, if you do encounter it again or aren't convinced we're resolved this do let us know... |
Hi folks. I'm encountering issues again with processing UM data. It's a related task to ticket #817 but a different error so I figured I'd start a new topic.
I can load in a single file (either on a surface level, UM tiles, or pressure levels) with no problem and perform usual cf-python tasks like amending and adding attributes, but when it comes to writing the file I get an unhashable type error as follows:
I've managed to process hourly and daily files with this workflow and v similar code with no problem so far. I've also double-checked that all the files I'm currently trying to process here are fully formed and compliant, so that's not the issue (I think this was the main problem in my previous ticket).
I have also tested this behaviour with a MWE, where I load a UM file and then try to write it to netcdf, and the same occurs, i.e.
Can you help me understand what's going on here? I am able to save the fields in iris without a problem, so it doesn't seem to be packing or underlying file problem, but I'd like to use cf-python to maintain consistency with the other files I've post-processed with this method.
The text was updated successfully, but these errors were encountered: