[ncl-talk] Assigning a variable as apart of the dimensions of a new variable

Anne anne.seidenglanz at unive.it
Tue Aug 13 03:23:34 MDT 2019


Hi Rick,

thanks or your answer, in the end it did work. I had defined the variable
further up in the script already which I had overlooked... so one should
always check the script carefully!

Thanks for your help,
Anne

On Mon, Aug 12, 2019 at 3:35 PM Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi,
>
> At first glance, I would have thought those assignments should work, and
> indeed, if I try the simple test below, it does work.  Perhaps you might
> provide a printVarSummary() of the variables u, v, and var?
>
> a = new((/2,3,4/),float)
> b = (/ (/1,2,3,4/), (/2,3,4,5/), (/3,4,5,6/) /)
> a(0,:,:) = b
> print(a)
>
>
> Variable: a
> Type: float
> Total Size: 96 bytes
>             24 values
> Number of Dimensions: 3
> Dimensions and sizes:   [2] x [3] x [4]
> Coordinates:
> Number Of Attributes: 1
>   _FillValue :  9.96921e+36
> (0,0,0)  1
> (0,0,1)  2
> (0,0,2)  3
> (0,0,3)  4
> (0,1,0)  2
> (0,1,1)  3
> (0,1,2)  4
> (0,1,3)  5
> (0,2,0)  3
> (0,2,1)  4
> (0,2,2)  5
> (0,2,3)  6
> (1,0,0) 9.96921e+36
> (1,0,1) 9.96921e+36
> (1,0,2) 9.96921e+36
> (1,0,3) 9.96921e+36
> (1,1,0) 9.96921e+36
> (1,1,1) 9.96921e+36
> (1,1,2) 9.96921e+36
> (1,1,3) 9.96921e+36
> (1,2,0) 9.96921e+36
> (1,2,1) 9.96921e+36
> (1,2,2) 9.96921e+36
> (1,2,3) 9.96921e+36
>
>
> On Mon, Aug 12, 2019 at 4:45 AM Anne via ncl-talk <ncl-talk at ucar.edu>
> wrote:
>
>> Hello NCL users,
>>
>> from a file, I am reading in u and v. As they are when I read them in,
>> they have dimensions:
>>
>>  u :   [time | 1374] x [lat | 180] x [lon | 360]
>>  v:    [time | 1374] x [lat | 180] x [lon | 360]
>>
>> Now I'd like to create a new variable "var" that ideally contains as a
>> 1st dimension both u and v like:
>>
>>  var = new((/2,1374,180,360/), float)
>>  var(0, : , : , : ) = u
>>  var(1, : , : , : ) = v
>>
>> but I get the error message that the dimensions of the left hand side and
>> the right hand side do not match... I suppose the problem is that the time,
>> lat, lon are coordinate variables while the 1st dimension is a physical
>> variable. Is there another, better, way to define 'var' in order to
>> allocate u and v in this way?
>>
>> Thanks,
>> Anne
>>
>> Nota automatica aggiunta dal sistema di posta.
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

-- 
Nota automatica aggiunta dal sistema di posta.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190813/93e97a82/attachment.html>


More information about the ncl-talk mailing list