Re: Help with lat2d & lon2d

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Nov 15 2010 - 12:40:01 MST

Hi Gina,

The error message is telling you exactly what the problem is. Your "modis_cloud" variable already has lat2d and lon2d attributes (note: these are attributes and not coordinate arrays), and they are *1D* variables of length 519841. You are trying to reassign these two attributes to *2D* arrays of size 721 x 721.

In NCL, you can't assign arrays of different dimensionality to each either, even if they are the same number of bytes.

Also, technically, attributes can only be 1D.

If you are just trying to overwrite your existing lat2d/lon2d attributes, then you can make lat and lon 1D with this code:

        modis_cloud@lat2d = ndtooned(lat) ; Convert 2D array to 1D
        modis_cloud@lon2d = ndtooned(lon)

--Mary

On Nov 15, 2010, at 12:07 PM, Gina Henderson wrote:

> Hi there,
>
> I am running into some trouble regarding assigning coordinate data to a variable. After I read my data in, I assign lat and lon values using "lat2d" and "lon2d" as follows:
>
> modis_cloud@lat2d = lat
> modis_cloud@lon2d = lon
>
> but get the following error from the above two lines:
>
> fatal:Dimensions of attribute and right-hand side of assignment do not match
>
> The variable modis_cloud is associated with the following info from printVarSummary:
>
> Variable: modis_cloud
> Type: float
> Total Size: 528158456 bytes
> 132039614 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 254] x [lat | 721] x [lon | 721]
> Coordinates:
> time: [1..254]
> Number Of Attributes: 3
> lon2d : <ARRAY of 519841 elements>
> lat2d : <ARRAY of 519841 elements>
> _FillValue : -99
> (0)
> (0) min=0 max=254
>
>
> My lat and lon arrays are both type float and of the shape 721x721.
>
> Does anyone have any suggestions where the mismatch is? as I am not seeing it right now.
>
> Thanks, Gina.
>
> _______________________________________________
> 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 Nov 15 12:40:13 2010

This archive was generated by hypermail 2.1.8 : Mon Nov 15 2010 - 12:45:32 MST