[ncl-talk] change lat lon

Guido Cioni guidocioni at gmail.com
Mon Oct 8 05:58:51 MDT 2018


Please make some effort to explain the problem more clearly next time.
People are here to help but they don't have time to decipher messages. 

If I understood well you have two variables, var1 and var2, which happen to contain precipitation data on two different grids. Both variables, according to your printVarSummary, have coordinates information inside them.

Then, if you want to zoom var2 in the same area as var1 is defined (again, I assume that is your goal from what you said, which is still not clear) you just need to obtain the lat/lon bounds and use them with coordinate subscripting { } (https://www.ncl.ucar.edu/Document/Language/subscript_coord.shtml <https://www.ncl.ucar.edu/Document/Language/subscript_coord.shtml>).

minlon = min(var1&longitude)
maxlon = max(var1&longitude)
minlat = min(var1&latitude)
maxlat = max(var1&latitude)

var2_zoom = var2(  :  , {minlat:maxlat} ,  {minlon:maxlon} )

> On 8. Oct 2018, at 13:37, Vanúcia Schumacher <vanucia-schumacher at hotmail.com> wrote:
> 
> Sorry, I want to get var2 for the same lat and lon coordinates of var1.
> De: Vanúcia Schumacher <vanucia-schumacher at hotmail.com <mailto:vanucia-schumacher at hotmail.com>>
> Enviado: segunda-feira, 8 de outubro de 2018 08:24:29
> Para: ncl-talk at ucar.edu
> Assunto: change lat lon
>  
> Hi NCL users,
> 
> How can I get a variable with latitude and longitude of another variable?
> For example, I want var2 to have the same lat and lon of var1, without changing resolution.
> 
> I tried this way, but don't work
> 
> 
>   minlat     = -37.44693
>   maxlat    = -31.94739
>   minlon    = -73.65259
>   maxlon   = -66.7254
> 
>  var2_zoom  = var2(:,minlat:maxlat,minlon:maxlon)
> 
> fatal:Illegal subscript. Subscripts must be integer when not using coordinate indexing
> 
> 
> Variable: var2
> Type: float
> Total Size: 4570560 bytes
>             1142640 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 240] x [latitude | 69] x [longitude | 69]
> Coordinates: 
>             time: [ 369..174945]
>             latitude: [-37.44693..-31.94739]
>             longitude: [-73.65259..-66.7254]
> Number Of Attributes: 5
>   units : mm
>   lon2d : <ARRAY of 4761 elements>
>   lat2d : <ARRAY of 4761 elements>
>   time : (    0,    6,   12,   18 )
>   description : Total Precipitation
> 
> Variable: var1
> Type: float
> Total Size: 19319040 bytes
>             4829760 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 240] x [latitude | 156] x [longitude | 129]
> Coordinates: 
>             time: [370.5..174946.5]
>             latitude: [-35.31664..-33.92255]
>             longitude: [-70.89447..-69.48352]
> Number Of Attributes: 5
>   units : mm
>   lon2d : <ARRAY of 20124 elements>
>   lat2d : <ARRAY of 20124 elements>
>   time : (    0,    3,    6,    9,   12,   15,   18,   21 )
>   description : Total Precipitation
> 
> 
> 
> 
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk


Guido Cioni
www.guidocioni.it

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


More information about the ncl-talk mailing list