Re: getind_latlon2d

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 06 2012 - 17:40:27 MST

NCL's coordinate subscripting

    data(time,lat,lon) ; lat and lon are 1d

    stalat = (/ ..., ..., ... /)
    stalon = (/ ..., ..., ... /)
    nsta = dimsizes(stalat)

    data_sta = new ( (/nsta,ntim/), typeof(data), getFillValue(data))
    do ns=0,nsta-1
       data_sta(ns,:) = data(:,{stalat(ns)},{stalon(ns)})
    end do

On 11/06/2012 05:31 PM, ousmane ndiaye wrote:
> Sorry
> here is what I actually wanted :
> I have GCM file in netcdf, X and Y are the variables for long and lat
> both each in 1D.
> I have stations location and want to find the nearest grid cell from the
> netcdf file. I want to use getind_latlon2d but it has as input lat2d and
> lon2d
> any help
> Ousmane
>
>
> On Wed, Nov 7, 2012 at 12:21 AM, Dennis Shea <shea@ucar.edu
> <mailto:shea@ucar.edu>> wrote:
>
> [1] Not sure why you want to compute lat2d/lon2d but ...
>
> nlat = dimsizes(lat)
> mlon = dimsizes(lon)
>
> lat2d= comform_dims( (/nlat,mlon/), lat, 0)
> lon2d= comform_dims( (/nlat,mlon/), lon, 1)
>
> [2] If the lat and lon are 1D
>
> jlat = ind(lat.eq.???)
> ilon = ind(lon,eq.???)
>
>
>
>
>
> On 11/06/2012 05:16 PM, ousmane ndiaye wrote:
>
> Hi all,
> Little but stuck/confused here : the inputs of getind_latlon2d aka
> "lat2d" and "lon2d" are 2D and it is said for lat2d "A
> two-dimensional
> array that contains latitudes."
> if I have lat1d from the model 1D how can I construct lat2d?
> Ousmane
>
>
>
> _________________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/__mailman/listinfo/ncl-talk
> <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 Tue Nov 6 17:40:35 2012

This archive was generated by hypermail 2.1.8 : Tue Nov 13 2012 - 14:27:24 MST