Re: the variable attribute problem when writing netcdf4 file

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Tue May 13 2014 - 08:49:29 MDT

SongFengfei,

It is probably that your CESM netCDF is compared with Classic NetCDF4,
which means it won't be able to read any (true) NetCDF4 files.

The simple way is regenerate your file, with options:

setfileoption("nc","format","NetCDF4Classic")

Or:

setfileoption("nc","format","Classic")

Or, just comment out the setfileoption line, which will use the default value "Classic".

Regards,

Wei

On May 12, 2014, at 11:10 PM, songfengfei <songfengfei@mail.iap.ac.cn> wrote:

> Dear all,
>
> I am a doctor student from IAP, China. My NCL version is 6.1.0. I write the netcdf4 file by setting " setfileoption("nc","format","NetCDF4") ".
>
> When I check the nc file by using the command "ncdump -h *.nc" and find the attributes are listed below:
>
> netcdf sst_c4_hist1_hadisst_1950_2005-try {
> dimensions:
> time = 124 ;
> y = 384 ;
> x = 320 ;
> variables:
> int time(time) ;
> float sstf(time, y, x) ;
> string sstf:grid_loc = "3111" ;
> string sstf:coordinates = "TLONG TLAT" ;
> string sstf:units = "degC" ;
> string sstf:long_name = "Surface Potential Temperature" ;
>
> It is found that before all attributes, there is "string", which is different from writing variable as netcdf3 format.
>
> When I use the cesm model to read this netcdf4 file, there is an error showing "Error reading grid_loc from netCDF file" but this problem is missing when using the netcdf3 file. Hence, I think the problem may be rooted in the attribute type,
>
> Can you give some suggestions about this question or how to remove the string?
>
> Thanks
>
> songfengfei
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue May 13 08:49:44 2014

This archive was generated by hypermail 2.1.8 : Tue May 20 2014 - 10:18:04 MDT