Stream: python-questions

Topic: Strange ncdump behavior


view this post on Zulip Isla Simpson (Feb 02 2024 at 23:33):

Hello, At least both Nan and I have experienced this issue. I'm wondering if anyone else has and knows what's happening. When I write data out to netcdf from python using xarray data arrays or datasets and then do an ncdump on the file to display the coordinates, the coordinates appear to contain empty values. However, they are not actually empty if you read the data back into python. Attached is an example. I simply read in a file and write it back out again. If I do an ncdump on the output file it has empty values for all the coordinates but on reading it back in, the coordinates have the right values. I don't know whether this is an ncdump problem, a python problem, or a derecho/casper problem. Thanks for any help on this.

Screenshot-at-2024-02-02-16-30-59.png

view this post on Zulip Isla Simpson (Feb 02 2024 at 23:37):

Another piece of information is that this same problem does not happen on the CGD machines, suggesting it's either a derecho/casper problem or an environment problem.

view this post on Zulip Isla Simpson (Feb 02 2024 at 23:56):

Another piece of information. The same file that has missing values for the coordinates on derecho with an ncdump looks normal on another machine. So it appears to be narrowed down to an ncdump issue on derecho. I will open up a ticket with cislhelp.

view this post on Zulip Sam Rabin (Feb 07 2024 at 16:45):

@Will Wieder noticed a similar issue with the most recent CTSM parameter file, which has a new _FillValue attribute (set to NaN) on all the variables. When I remove that attribute with ncatted -a _FillValue,varname,d,, oldfile.nc newfile.nc, ncdump works as expected.

view this post on Zulip Sam Rabin (Feb 07 2024 at 16:50):

This unfortunately happens with both versions of the nco module on Casper, 5.1.9 (the default) and 5.1.6

view this post on Zulip Will Wieder (Feb 07 2024 at 16:51):

I'll also ad that we're working to correct this metadata issue in upcoming CTSM tags, but Sam's suggestions seem like a OK workaround for now?

view this post on Zulip Isla Simpson (Feb 07 2024 at 17:08):

OK, thanks It seems strange that this workaround is needed, but it's good to know.

view this post on Zulip Nan Rosenbloom (Feb 08 2024 at 03:05):

With Brian Dobbins help: this fixes it too:
module swap intel gcc

view this post on Zulip Katie Dagon (Feb 08 2024 at 17:40):

Sounds related to what was posted in the CISL DailyB this morning: https://arc.ucar.edu/articles/609


Last updated: May 16 2025 at 17:14 UTC