Giter Site home page Giter Site logo

Comments (6)

simon3122 avatar simon3122 commented on June 13, 2024

This problem was when reading a Netcdf4 file.
But is not anymore when reading a Netcdf3 file, written with these options.

ds.to_netcdf(filenam,
'w',
format='NETCDF3_64BIT'
engine='scipy',
encoding={ vkey2:{'dtype':'float32'}})

from oocgcm.

lesommer avatar lesommer commented on June 13, 2024

Hi Simon,
could you please look in more detail and let me know what is the vkey/vname that returns the exception ?
thanks.

from oocgcm.

simon3122 avatar simon3122 commented on June 13, 2024

I am working on NEMO data with the following variables:
vkey = 'sea level'
vkey2 = vdict[vkey]['vname']
The dictionary is defined as follows:
vdict['sea level']={'vname': 'sossheig', ...

If it can provide information, here are my options to output in Netcdf4 (which raises a problem at the following reading stage)
ds.to_netcdf(filenam,'w',format='NETCDF4', engine='netcdf4', encoding={ vkey2:{'_FillValue':0,'dtype':'float32'}})

from oocgcm.

lesommer avatar lesommer commented on June 13, 2024

I suspect this related to the options used in reading netcdf files in core.io.
NB : these options have changed in the trunk (see)

  1. could you try to open your newly created dataset directly from xarray methods ?
  2. try without specifying chunk size for 't' dimension {'y': chunks[-2], 'x': chunks[-1]}

from oocgcm.

simon3122 avatar simon3122 commented on June 13, 2024

First, I noticed that I can not create the xarray.dataset: the error comes immediately from the open_mfdataset function

Here are my results:

  1. Replacing
    io.return_xarray_mfdataset(filemean,chunks=xr_chunks_tmean)
    with
    xr.open_mfdataset(filemean,chunks=xr_chunks_tmean,engine='netcdf4',lock=False)

    does not change the result

  2. Leaving out the 't' dimension provides this error:
    ValueError: some chunks keys are not dimensions on this object: ['y', 'x']

I can add another result : when specifying chunk=None in the xarray function, the dataset again can not be read properly:
print xr.open_mfdataset(filemean,chunks=None,engine='netcdf4',lock=False)
gives

<xarray.Dataset>
Dimensions:  ()
Coordinates:
    *empty*
Data variables:
    *empty*

from oocgcm.

simon3122 avatar simon3122 commented on June 13, 2024

The blocking version was when writing the file
ds.to_netcdf(filenam,'w','NETCDF4', 'netcdf4'...}})
which gives the following header

group: netcdf4 {
  dimensions:
    y = 3454 ;
    x = 5422 ;

In fact, it works when writing the file
ds.to_netcdf(filenam,'w',format='NETCDF4', engine='netcdf4'...}})
which gives the following header

dimensions:
    y = 3454 ;
    x = 5422 ;

The first version seems to create an inner netcdf4 group which might not be a standard Netcdf4 file.
I understand that Xarray reading function may not read properly the first version (with an inner group) if the option 'group' is not filled.

from oocgcm.

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.