回复: Re: the variable attribute problem when writing netcdf4 file

From: songfengfei <songfengfei_at_nyahnyahspammersnyahnyah>
Date: Wed May 14 2014 - 01:14:04 MDT

Dear Huang,

Following your suggestion, I change the option as "setfileoption("nc","format","NetCDF4Classic")" since my writing file is very large (9.36G). After doing this, the "string" before the attribute disappears.

Thanks very much.

Fengfei




songfengfei

发件人: Wei Huang
发送时间: 2014-05-13 22:49
收件人: songfengfei
抄送: ncl-talk
主题: Re: [ncl-talk] the variable attribute problem when writing netcdf4 file
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 Wed May 14 01:14:26 2014

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