[ncl-talk] writing new variable in NetCDF4 (ncl 6.3)

David Brown dbrown at ucar.edu
Tue Feb 2 12:26:25 MST 2016


The write option for addfiles has never undergone any real testing and
its use is not encouraged. We have hoped at some point to make it
viable but for the time being other issues have a much higher
priority. As a side note, in the example code the variable 'a' is a
list, not a file reference. Therefore this line:
a->AQI(it,:,:) = (/AQI(it,:,:)/)
should be giving a syntax error, unless it was really written as something like:
a[it]->AQI(it,:,:) = (/AQI(it,:,:)/)
 -dave

On Tue, Feb 2, 2016 at 6:04 AM, Guido Cioni <guidocioni at gmail.com> wrote:
> I don’t know if it helps but using the “w” option in addfile function was
> giving me a lot of errors in NCL 6.3.0, while the older version was working
> well. Unfortunately I didn’t had time to investigate the error: having both
> versions I just needed to load and unload the module when I needed to write
> on a netcdf file.
> Maybe someone can give you more useful informations.
>
> Guido Cioni
> http://guidocioni.altervista.org
>
> On 02 Feb 2016, at 13:52, Hanna Ojrzyńska <hanna.ojrzynska at uni.wroc.pl>
> wrote:
>
> Dear all,
> I wrote script to calculate new AQI index from data existing in wrfout file
> (NetCDF4). I want to write new variable (AQI) in those NetCDF4.
>
> Below important parts of script:
>
>
> ################################
>
> a = addfile(FILES(ifil)+".nc","w")
> ...
>
> T2=wrf_user_getvar(a,"T2",-1)
>
> AQI at long_name="Air Quality Index"
> AQI at short_name="AQI")
> filevardef(a, "AQI",typeof(T2), getvardims(T2))
>
>
> a->AQI(it,:,:) = (/AQI(it,:,:)/)
>
> ##################################
>
> It runs in ncl 6.1.0 but in 6.3.0 I recived:
>
> fatal:["NclNetCDF4.c":3073]:NclNetCDF4.c: Error in nc_def_var_chunking in
> file (/home/hano/Documents/scripts/wrfout_d03_2014-01-26_00:00:00.nc) for
> writing, at line: 3073
>
> line 3074 of NclNetCDF4.c: NetCDF: Attempt to define var properties, like
> deflate, after enddef.
>
> What is the reason?
>
> --
> Dr inż. Hanna Ojrzyńska
>
> Uniwersytet Wrocławski
> Instytut Geografii i Rozwoju Regionalnego
> Zakład Klimatologii i Ochrony Atmosfery
> www.meteo.uni.wroc.pl
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


More information about the ncl-talk mailing list