Comments (6)
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.
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.
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.
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.
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.
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)
- New "original filenames" methods
- Incorrect data assignment with some multiple list indices HOT 4
- Allow data to be omitted from netCDF files during `cfdm.write`
- Zero values reported by `repr` on fully-masked datetime arrays
- Slight change in `_FillValue` property value on write-read
- Creat new `SubsampledSubarray` subclass for the case of no standardised interpolation algorithm
- Document accepted argument types for `source` parameters
- (Document) rename of default branch from `master` to `main` HOT 1
- Relocate the call to `_customize_read_vars()` in `NetCDFRead.read`
- Improve source docstrings in `__init__` methods
- Prepare for v1.10.0.2 HOT 2
- New `ignore_properties` keyword to `cfdm.unique_constructs` HOT 1
- Incorrect `formula_terms` in output netCDF files in some cases
- External cell measure netCDF variable names are not always preserved by `cf.write`
- Allow file missing data indicator values to be stored on `NetCDFArray` instances
- Error from `Data.second_element` for some data shapes
- Make `cfdm.read` always return unicode strings from netCDF files HOT 1
- Error when writing to disk coordinates with a computed_standard_name
- Very slow reads of datasets with compession by gathering or DSG ragged arrays
- Reading of `http://` remote files does not work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cfdm.