Re: gives warning that dimension already exists

From: Donna Cote <d-cote_at_nyahnyahspammersnyahnyah>
Date: Wed, 05 Nov 2008 13:20:59 -0600

Dennis, I see your point about choosing to replace a variable vs adding
one, but one of my goals is to avoid using any NCO operators.

Am I not allowed to *replace* the "char Times(Time, DateStrLen) ;"
variable with a
       double Times(Time) ;
             Times:units = "hours since 2001-06-11 12:00:00" ;
               Times:long_name = "Time" ;
              Times:description = "Time" ;
(Time Coordinate) variable?

Is there a function of the form of GetVar which would accomplish a merge
(instead of using the ncrcat or ncks operator)? I imagine I would have
to use GetVar (not sure of the name) on each and every variable that I
want to merge in. For my first goal, which is to get just the V10,U10
and slp variables from WRF to a Time Coordinate format, copying over
these few variables would be trivial.

Maybe, starting with this small example, you could help me find a way to
have NCL do all the work?

Thanks
Donna

Dennis Shea wrote:
> I don't think you can not use the "w" on the addfile line.
>
> This is for replacing values of an *existing* variable.
> EG: Say you want to change temperature from C to K.
> No new space is needed on the file. The new values just overwrite
> the old values.
>
> You want to *add* a new variable. Something like
>
> netcdf WRF.CF {
> dimensions:
> Time = UNLIMITED ; // (25 currently)
> DateStrLen = 19 ;
> bottom_top = 27 ; south_north = 81 ;
> west_east = 90 ;
> variables:
> double Time(Time) ;
> Time:units = "hours since 2001-06-11 12:00:00" ;
> Time:long_name = "Time" ;
> Time:description = "Time" ;
> char Times(Time, DateStrLen) ;
>
> where The Time(Time) has been added.
>
> A suggested way of doing this:
>
> [1] Use NCL to read the character variable 'Times'
> [2] Use
> http://www.ncl.ucar.edu/Document/Functions/WRF_contributed/wrf_times_c.shtml
>
> to create the numeric variable Time(Time)
> [3] Create a file with just this variable on it.
> [3] Use the netCDF operator ncks [, ncrcat] to merge
> the two files.
>
> Good luck
>
>
> Donna Cote wrote:
>> The purpose of my little script is to read a WRF file
>> (wrfout_d01...blah.blah.blah) and change the Time variable from
>> character to a Time Coordinate var.
>> I am reading in a file with the "w" option [ f=addfile(outname,"w") ]
>>
>> I am wondering if I need to "undefine" the Time dimension in order to
>> replace it or change it.
>>
>> Thanks,
>> Donna Cote
>>
>> <big snip>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Nov 05 2008 - 12:20:59 MST

This archive was generated by hypermail 2.2.0 : Fri Nov 07 2008 - 13:41:15 MST