[ncl-talk] Editing a netcdf4 file

Gerry Creager - NOAA Affiliate gerry.creager at noaa.gov
Tue Jun 2 10:34:38 MDT 2015


Additional information: If we do an addfile("<filename>","r"), we can open
and read the file. If we use "w", well, we can open the file but assigning
an existing variable to an internal variable fails on the assign (var =
a->QRAIN). Of course, because it fails there, we can't see if it'd also
fail on write.

Thanks
Gerry

On Mon, Jun 1, 2015 at 7:15 PM, Gerry Creager - NOAA Affiliate <
gerry.creager at noaa.gov> wrote:

> I've started looking at this with Dusty. Appreciate any thought you might
> have as to why we're failing.
>
> I've uploaded the input file (wrfinput_d02) to the FTP incoming site. I'm
> testing with the script:
>
> var = "QRAIN"
> print(var)
> a=addfile("wrfinput_d02.nc", "w")
> var_orig=a->QRAIN
> print(var_orig)
>
>
> The result looks like:gerry at loki:~/NEWSe/NCL> ncl test.ncl
>  Copyright (C) 1995-2015 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 6.3.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
>
>
> Variable: var
> Type: string
> Total Size: 8 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) QRAIN
> fatal:["NclNetCDF4.c":3073]:NclNetCDF4.c: Error in nc_def_var_chunking in
> file (wrfinput_d02.nc) for writing, at line: 3073
>
> line 3074 of NclNetCDF4.c: NetCDF: Attempt to define var properties, like
> deflate, after enddef.
>
>
> On Fri, May 29, 2015 at 8:54 PM, Dustan Wheatley - NOAA Affiliate <
> dustan.wheatley at noaa.gov> wrote:
>
>> I am trying to overwrite a netcdf4 file analogous to what is shown at
>> http://www.ncl.ucar.edu/Applications/change_netCDF.shtml
>> <https://exchange.ou.edu/owa/redir.aspx?C=owjNhXjJeU2q3l_CtHOdFTi5otfobdIIrQJSmDqpIJwEqeu5PSxBrYF-uWWKJzwXX3oP_TJTgXA.&URL=http%3a%2f%2fwww.ncl.ucar.edu%2fApplications%2fchange_netCDF.shtml>.
>> In the attached ncl script, I open the file to be modified at line 35 and
>> attempt the modification at line 73 (with a lot of calculations in
>> between).  While I have double-checked that the modified field (var_mod)
>> has the same dimensionality as the original variable (QRAIN), I am still
>> get a segmentation fault/core dump.  Never had this problem when I tried to
>> manipulate netcdf3 files.  Could it possibly be related to the netcdf4
>> compression?  It’s possible I may be trying to do something that’s no
>> longer possible.
>>
>> Thanks in advance for any suggestions.
>>
>> -Dusty Wheatley
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> Gerry Creager
> NSSL/CIMMS
> 405.325.6371
> ++++++++++++++++++++++
> “Big whorls have little whorls,
> That feed on their velocity;
> And little whorls have lesser whorls,
> And so on to viscosity.”
> Lewis Fry Richardson (1881-1953)
>



-- 
Gerry Creager
NSSL/CIMMS
405.325.6371
++++++++++++++++++++++
“Big whorls have little whorls,
That feed on their velocity;
And little whorls have lesser whorls,
And so on to viscosity.”
Lewis Fry Richardson (1881-1953)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150602/5d47a757/attachment.html 


More information about the ncl-talk mailing list