Re: I want to change the sort of attributes for a netCDF file

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Mon, 02 Mar 2009 11:59:37 -0700

Hi Ehsan,
The order that the attributes are written is opposite to how they are
shown in the netCDF file (or in the output of printVarSummary). For example:

ncl 1> a = addfile("example.nc","c")
ncl 2> var = (/1,2,3,4/)
ncl 3> var!0 = "var"
ncl 4> var&var = var
ncl 5> var_at_att1 = "Attribute 1"
ncl 6> var_at_att2 = "Attribute 2"
ncl 7> var_at_att3 = "Attribute 3"
ncl 8> a->var = var
ncl 9> exit

-/home/>ncdump -h example.nc | less
netcdf what {
dimensions:
         var = 4 ;
variables:
         int var(var) ;
                 var:att3 = "Attribute 3" ;
                 var:att2 = "Attribute 2" ;
                 var:att1 = "Attribute 1" ;

I know of no quick way to alter the order of attributes in a netCDF
file. The only ways I can think of are: by either editing it by hand in
NCL (by using the "w" option of addfiles), or by using the ncatted
netCDF operator and deleting and then recreating the attributes in the
proper order.
Adam

Ehsan Khorsandi wrote:
> Dear all,
>
> I maked a netCDF file and the attribute are in sort that I don't need,
> they are like this:
>
> float ALD2(TSTEP, LAY, ROW, COL) ;
> ALD2:var_desc = "Model species ALD2
> " ;
> ALD2:units = "moles/s " ;
> ALD2:long_name = "ALD2 " ;
>
>
> and want the attributes in this way:
>
>
> float ALD2(TSTEP, LAY, ROW, COL) ;
> ALD2:units = "moles/s " ;
> ALD2:long_name = "ALD2 " ;
> ALD2:var_desc = "Model species ALD2
> " ;
>
>
> I checked all way but there were no chance please see if you can help me to make attributes sorted as I need.
>
> Thanks,
> Ehsan
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Mar 02 2009 - 11:59:37 MST

This archive was generated by hypermail 2.2.0 : Mon Mar 02 2009 - 16:45:42 MST