Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Error modifying wrfinput_d01 using NCL

jethong

New member
Hello,

I am trying to modify the value of a certain variable of wrfinput_d01 using NCL. For example, the following code:
----------------
a=addfile("wrfinput_d01","w"),
x =a->HGT
----------------

It returns the following error message:
----------------
fatal:["NclNetCDF4.c":3073]:NclNetCDF4.c: Error in nc_def_var_chunking in file (wrfinput_d01) for writing, at line: 3073
line 3074 of NclNetCDF4.c: NetCDF: Attempt to define var properties, like deflate, after enddef.
----------------

For read only mode (a=addfile("wrfinput_d01","r")), it won't cause any error.

I searched google, and learned that it probably owning to something like data format or compression format issues, but I am not sure.

Is there any solutions to this issue ?

I appreciate any response.

Jet
 
Please follow the example below to modify tour data:

in = addfile("./met_em.d01.2017-09-12_00:00:00.nc","w")


xlat=in->XLAT


print (xlat)


new_xlat=0


in->XLAT=new_xlat


You may need to rename wrfout_d01 to wrfout_d01.nc.
 
Dear Ming,

Thank you for the reply.
The ncl ended when trying to read variable and return same error, as follows:

ncl 0> a=addfile("met_em.d01.2019-01-01_06:00:00.nc","w")
ncl 1> x=a->XLAT_U
fatal:["NclNetCDF4.c":3073]:NclNetCDF4.c: Error in nc_def_var_chunking in file (met_em.d01.2019-01-01_06:00:00.nc) for writing, at line: 3073
line 3074 of NclNetCDF4.c: NetCDF: Attempt to define var properties, like deflate, after enddef.

Jet
 
Jet,
I believe this is either a data issue or NCL version issue.
I just tried the same method to process a met-em file, and all works fine. I cannot repeat your problem.
 
Top