Comments (7)
Friendly ping on this. Any ideas?
from iris-grib.
I'm updating to 0.17.1 and 3.0.2 and I'll report back.
from iris-grib.
Nope this is still an issue.
from iris-grib.
Also when writing it is changing my fill values to 1+e20 is there a way to specify not to do this?
from iris-grib.
Sorry I should probably have replied to this, but I'm short on time at the moment.
Very briefly, though (if it helps) ..
(1) Regarding the time dimension
When you write data to GRIB each message is a 2D field. If you save multiple fields whcih differ only in time, then on loading back iris will convert each field into a 2D cube (what we call a "raw cube"), and then merge them to create a time dimension.
But in this case there is only 1 timepoint (= one message) so there is nothing to merge and Iris won't create a time dimension.
Netcdf is different because the file format itself represents multidimensional variables, so it can represent the difference between data with a scalar time coord and with a time dimension of only 1 point.
You can convert a scalar time coord to a dimension with iris.util.new_axis.
The converse, of course is just to take cube[0]
, turning the dim-coord into a scalar coord.
(2) Regarding the phenomenon
Your original data seems to have a conflict between the standard name of "sea_water_y_velocity" and the GRIB_PARAM attribute of "GRIB2:d010c001n002" -- which I think is 'x_velocity'
At least, in our code tables we have :
CFName('sea_water_x_velocity', None, 'm s-1'): G2Param(2, 10, 1, 2),
CFName('sea_water_y_velocity', None, 'm s-1'): G2Param(2, 10, 1, 3),
I guess that is correct, but I haven't checked against the latest GRIB spec.
Anyway, the key point is that a GRIB_PARAM attribute will define what discipline/category/parameter values are actually written into a saved GRIB message, which overrides any translation derived from the standard_name as noted here, so that is what has happened here.
(3) Regarding the fill-value
This is a thorny problem.
A GRIB message can encode missing data points, but it does not store any fill-value at all (it records missing points in a different way).
So, when Iris-grib writes a grib message with missing data, the fill value is simply lost.
Then, when Iris-grib reads a grib message with missing points, it constructs a numpy masked array with the usual default fill-value for its dtype.
In fact the fill-value of a numpy arrays doesn't actually mean much : you can just change it, and its only real use is to be the default value used by an "array.filled()" call. Numpy calculations don't preserve it either -- it goes back to the default whenever a new array is produced to store a result.
( If you know about dask, which is important to Iris, this also has problems : fill-value is not a stable property of lazy arrays; different sections of the same array will be masked or unmasked according to whether any masked data is contained, so of course a fill-value does not exist for unmasked portions).
For all those reasons, Iris doesn't even preserve the fill-values of numpy array in a netcdf save : you can control it, but the default is not taken from the data array. We have a documentation section about that.
Sorry this is such a brain-dump, I'm trying to be quick.
Hope some of this is of use ...
from iris-grib.
The support for this repo is honestly fantastic. Thanks so much for this, it does give me quite a bit to chase down.
from iris-grib.
Many thanks for your appreciation.
Really pleased if it helps !
from iris-grib.
Related Issues (20)
- Incorrectly loaded grib file on Windows HOT 10
- Incorrect coding of x_start/y_start for space view grid definition HOT 3
- Inaccurate method for calculating GRIB1 coordinates HOT 2
- iris.exceptions.TranslationError: grib statistic time-increment type [3] is not supported. HOT 2
- Add support for Fixed surface type 108 HOT 1
- Replace nox with tox
- Incorrect translation of forecastTimeUnits for values other than "hours" on bounded forecast_period coordinates HOT 2
- No documentation of GRIB_PARAM
- Grid definition template 32769 is not supported HOT 5
- Loading grib 1 doesn't create realization dimension HOT 3
- When using print(cube) for GRIB-2 format data there are many occurrences of unknown/(unknown) in the first line of output HOT 7
- Saving Iris Cubes containing GRIB-2 data is changing 'Fixed Surface' settings to inconsistent values. HOT 3
- Migrate from Cirrus CI to GitHub Actions
- Save LAEA (Lambert Azimuthal Equal Area) grid HOT 1
- Publish a release roadmap
- GriB file with constant field (all values = 0) throws an error HOT 11
- Installation from PyPI leads to errors when loading GRIB files HOT 1
- scitools
- Documentation Failing to build on RTD HOT 4
- Adopt more modern automation strategies
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 iris-grib.