[ncl-talk] Error in nc_def_var_chunking in file (domain_cfg.nc) for writing

边晴云 bianqy at tea.ac.cn
Tue Oct 27 01:38:58 MDT 2020




Dear All,




I was trying to change the value of an int variable in a netcdf file using NCL. Followed are my code:




begin

fin = addfile("domain_cfg.nc","rw")
data=fin->jperio
data_v = new(dimsizes(data),typeof(data),data at _FillValue)
data_v = 0


copy_VarMeta(data,data_v)
fin->jperio = data_v

end





However, I got the following error message:

--------

fatal:["NclNetCDF4.c":3073]:NclNetCDF4.c: Error in nc_def_var_chunking in file (domain_cfg.nc) for writing, at line: 3073

line 3074 of NclNetCDF4.c: NetCDF: Attempt to define var properties, like deflate, after enddef.





I have no idea how to resolve it. Any suggestions?

Thank you!




Followed are some information about the  netcdf file.

---------

netcdf domain_cfg {
dimensions:
        x = 2710 ;
        y = 1542 ;
        z = 75 ;
        t = UNLIMITED ; // (1 currently)
variables:
        float nav_lon(y, x) ;
                nav_lon:_Storage = "chunked" ;
                nav_lon:_ChunkSizes = 135, 206 ;
                nav_lon:_Endianness = "little" ;
        float nav_lat(y, x) ;
                nav_lat:_Storage = "chunked" ;
                nav_lat:_ChunkSizes = 135, 206 ;
                nav_lat:_Endianness = "little" ;
        float nav_lev(z) ;
                nav_lev:_Storage = "chunked" ;
                nav_lev:_ChunkSizes = 1 ;
                nav_lev:_Endianness = "little" ;
        double time_counter(t) ;
                time_counter:_Storage = "chunked" ;
                time_counter:_ChunkSizes = 1 ;
                time_counter:_Endianness = "little" ;
        int jpiglo ;
                jpiglo:_Endianness = "little" ;
        int jpjglo ;
                jpjglo:_Endianness = "little" ;
        int jpkglo ;
                jpkglo:_Endianness = "little" ;
        int jperio ;
                jperio:_Endianness = "little" ;
        double glamt(t, y, x) ;
                glamt:_Storage = "chunked" ;
                glamt:_ChunkSizes = 1, 135, 206 ;
                glamt:_Endianness = "little" ;
        double glamu(t, y, x) ;
                glamu:_Storage = "chunked" ;
                glamu:_ChunkSizes = 1, 135, 206 ;
                glamu:_Endianness = "little" ;

// global attributes:
                :file_name = "domain_cfg.nc" ;
                :TimeStamp = "24/08/2020 16:38:57 +0800" ;
                :_NCProperties = "version=1|netcdflibversion=4.4.1|hdf5libversion=1.8.13" ;
                :_SuperblockVersion = 0 ;
                :_IsNetcdf4 = 1 ;
                :_Format = "netCDF-4" ;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201027/17f57bf1/attachment.html>


More information about the ncl-talk mailing list