Re: problem using conform_dims

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 25 Mar 2009 08:06:13 -0600

Dorita,

There are a few things wrong.

First, you have this:

     copy_VarAtts( data1, rrate) ; contributed.ncl

This is copying attributes from data1 to rrate. Then, you have:

       ncdf->RRATE = data1

Shouldn't "data1" be "rrate"?

       ncdf->RRATE = rrate

The NetCDF file has time=0, because you haven't written
"time" to the file. You've *defined* time as an unlimited dimension
with:

     filedimdef(ncdf,"time",-1,True)

But this doesn't write any time values to the file.

The time values won't get written until you actually
do something like:

    ncdf->time = time

Or until you write another variable to the file that has a time
coordinate array. This should be accomplished once
you fix the above "ncdf" line.

Finally, you set time to a string. You can't write strings to a NetCDF.

Try setting time to a value, like 1.

   time = 1

--Mary

On Mar 25, 2009, at 7:30 AM, Dorita Rostkier-Edelstein wrote:

> I see, I corrected it, it does not complain now, but it still writes
> that there are zero records. See the ncdump result that I get:
>
> dimensions:
> time = UNLIMITED ; // (0 currently)
> lat = 1649 ;
> lon = 4948 ;
> variables:
> float RRATE(lat, lon) ;
> RRATE:_FillValue = -1.f ;
> float lat(lat) ;
> lat:units = "degrees_north" ;
> float lon(lon) ;
> lon:units = "degrees_east" ;
>
> Thanks.
> =====================================
> Dr. Dorita Rostkier-Edelstein, Ph.D.
>
> http://www.geocities.com/drostkier/DO_page.html
> =====================================
>
>
> From: Mary Haley <haley_at_ucar.edu>
> To: Dorita Rostkier-Edelstein <drostkier_at_yahoo.com>
> Cc: ncl-talk_at_ucar.edu
> Sent: Wednesday, March 25, 2009 3:12:56 PM
> Subject: Re: problem using conform_dims
>
> Dorita,
>
> The first argument to conform_dims must be the dimension sizes of
> the array
> you want to create and conform the other array to. You are actually
> passing
> in the whole array of values.
>
> First, you have the dimension sizes of the lat, lon arrays:
>
> lat=fspan(59.963614,-59.963614,1649)
> lon=fspan(0.036378335,359.963614,4948)
>
> I would assign the lat,lon dimension sizes to local variables,
> so we can use them later in the script:
>
> nlat = 1649
> nlon = 4948
> lat=fspan(59.963614,-59.963614,nlat)
> lon=fspan(0.036378335,359.963614,nlon)
>
> Then, in the conform_dims call:
>
> rrate = conform_dims( (/1,nlat,nlon/), data1, (/1,2/) )
>
> --Mary
>
>
> On Mar 25, 2009, at 2:03 AM, Dorita Rostkier-Edelstein wrote:
>
>> Hello,
>>
>> I am trying to write a nc file and in the way to do so I try to use
>> conform_dims. I use it to try to output the record number.
>> Otherwise, the direct writing of the data without the record
>> information works fine.
>>
>> I get the following error:
>>
>> fatal:_NclBuildArray: each element of a literal array must have the
>> same dimension sizes, at least one item doesn't
>> fatal:Execute: Error occurred at or near line 38 in file
>> morph2nc_time_5.1_q.nc
>>
>> The script is only a few lines long and is attached.
>>
>> Thanks,
>>
>> Dorita
>>
>>
>> =====================================
>> Dr. Dorita Rostkier-Edelstein, Ph.D.
>>
>> http://www.geocities.com/drostkier/DO_page.html
>> =====================================
>>
>> <morph2nc_time_5.1_q.nc>
>> _______________________________________________
>> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Mar 25 2009 - 08:06:13 MDT

This archive was generated by hypermail 2.2.0 : Wed Mar 25 2009 - 15:36:00 MDT