Re: how to change dimension name

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Dec 16 2013 - 08:32:39 MST

You can operate on the variable file directly, by using the "w" option to addfile:

a = addfile("example.nc","w")
a->T!0 = "time"
a->T!1 = "lat"
etcetera

When you do this, it will operate on the file directly, and you can't undo the changes, so be very careful about this.
This will also cause all other variables on that file with the same named dimensions to be changed.

You should make a copy of your file before you do this kind of change.

You may also want to consider using a separate package for this kind of thing, if you need to do this for a lot of files.
See the "ncrename" utility that comes with the NetCDF operators:

http://nco.sourceforge.net/nco.html#ncrename-netCDF-Renamer

--Mary

On Dec 14, 2013, at 9:28 PM, 朱学明 <557xiaozhu@163.com> wrote:

> Hello Mary,
> Thanks for your reply.
> I know that "!" symbol just can change the variable's dimension name.
> But I want to change the dimension's name in the nc file. So what you mentioned may not make sense to me.
>
> Do you have any other suggestion still? Thanks.
>
> 2013-12-15
> Xueming Zhu 朱学明
> Key Laboratory of Research on Marine Hazards Forecasting (LoMF), SOA
> National Marine Environmental Forecasting Center (NMEFC)
> No.8, Dahuisi Road, Haidian District, Beijing, 100081
> People's Republic of China
> Tel:+86-10-82481923
> 发件人:Mary Haley <haley@ucar.edu>
> 发送时间:2013-12-14 00:49
> 主题:Re: [ncl-talk] how to change dimension name
> 收件人:"朱学明"<557xiaozhu@163.com>
> 抄送:"ncl-talk@ucar.edu USERS"<ncl-talk@ucar.edu>
>
>
> On Dec 12, 2013, at 1:03 PM, 朱学明 <557xiaozhu@163.com> wrote:
>
> > Hello all,
> > Anyone knows how can I change a nc file's dimension name?
>
> Use the "!" symbol.
>
> For example, if you read variable "T" off a NetCDF (or HDF, GRIB) file, and it has dimension names "TIME", "LATITUDE", and "LONGITUDE" (in that order), you can change them with:
>
> T!0 = "time"
> T!1 = "lat"
> T!2 = "lon"
>
> For more information, see the NCL Reference Manual:
>
> http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#Dimensions
>
> --Mary
>
> >
> > Thanks.
> >
> > 2013-12-13
> > Xueming Zhu 朱学明
> > Key Laboratory of Research on Marine Hazards Forecasting (LoMF), SOA
> > National Marine Environmental Forecasting Center (NMEFC)
> > No.8, Dahuisi Road, Haidian District, Beijing, 100081
> > People's Republic of China
> > Tel:+86-10-82481923
> > _______________________________________________
> > 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 Mon Dec 16 08:32:52 2013

This archive was generated by hypermail 2.1.8 : Wed Dec 18 2013 - 14:29:51 MST