Giter Site home page Giter Site logo

Comments (6)

davidhassell avatar davidhassell commented on May 26, 2024

Hi Martin,

I'm afraid that I can't replicate this, either at v1.7.1, or the latest version. That said, the line of code that you are causing problems was incorrect, and I have hopefully fixed it in the master branch.

I am not sure how you came to be running it with this example test_write.txt - could you try this?

Thanks,
David

from cfdm.

martinjuckes avatar martinjuckes commented on May 26, 2024

Hello David,

I get the same problem: it runs OK as it is, but if I comment out the tas.set_construct(horizontal_crs) line (because I want a file with a vertical CRS and no horizontal one -- which should be possible, shouldn't it?) the program crashes while trying to write the file as above. I have cfdm package version 1.7.3 and python netCDF4 version 1.5.1.1 running in python 3.5.2 (the exception occurs in the netCDF4 package, so it may depend on the version of that library).

Do I need to do something else to get a file which only has a vertical CRS?

regards,
Martin

from cfdm.

davidhassell avatar davidhassell commented on May 26, 2024

Thanks for the extra info. You should indeed be able to do what you want to. The vertical CRS has a datum, which is fine, which needs to be written as a grid mapping netCDF variable - and that bit code appears faulty. I'll investigate ...

from cfdm.

martinjuckes avatar martinjuckes commented on May 26, 2024

Thanks. I wasn't expecting a grid mapping variable for the vertical coordinates ... because CMOR doesn't generate one for this type of coordinate (just formula_terms).

from cfdm.

davidhassell avatar davidhassell commented on May 26, 2024

The latest code (v1.7.4 https://pypi.org/project/cfdm/) all seems to work fine for me - could you upgrade and give it a go?

The "new" grid mapping appears bcause the vertical CRS has a datum, but there is no appropriate horizontal CRS in which to store it.

If we don't set a datum on the vertical CRS , by removing in our test file the datum=datum line from

# Create the vertical coordinate reference construct
vertical_crs = cfdm.CoordinateReference(
                 datum=datum,
                 coordinate_conversion=coordinate_conversion_v,
                 coordinates=[dim_Z])

then you do not get the extra grid mapping variable.The connection of vertical CRSs to datums was, of course, new in CF-1.7

Thanks,
David

from cfdm.

martinjuckes avatar martinjuckes commented on May 26, 2024

Thanks, that works now.

I see what you mean with the datum ... but there appears to be some ambiguity about whether it is really needed. The CF convention says "A grid mapping variable if, in addition, it is desired to .....". At the moment, my impression is that the CMIP community are not possessed by such a desire ... though I would agree that it would be a good thing -- perhaps in CMIP7. I'm aiming to use cfdm to create some sample files. Now that I've update to 1.7.4 it looks as though it might work very nicely.

PS: there is still an issue (unrelated) with the cf-checker crashing when it finds a scalar coordinate used as an NetCDF4 dimension. This may not be your problem ... but your examples would be easier to work with if you avoided scalar coordinates used as dimensions.

from cfdm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.