Re: Get a value at agiven lat/lon point

From: Yann Bertrand <yann74_at_nyahnyahspammersnyahnyah>
Date: Mon May 05 2014 - 05:28:56 MDT

Mary, Thanks for your answer, and sorry for this late reply, sometimes i find emails from ncl-talk in my spam folder ... Your answer helped me, it was of course a problem of dimension. Thank you again Yann. Le Mardi 22 avril 2014 4h57, Mary Haley <haley_at_ucar.edu> a écrit : Yann, You can only use the "{" syntax if you have 1D coordinate arrays, which your data does not have: > Variable: gust > Type: float > Total Size: 4428 bytes >            1107 values > Number of Dimensions: 2 > Dimensions and sizes:  [ygrid_0 | 27] x [xgrid_0 | 41] > Coordinates: > Number Of Attributes: 14 Note there is no list of coordinate variables after the word "Coordinates:" It looks like you have 2D lat/lon arrays, so see the "getind_latlon2d" function: http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml Your lat/lon arrays are likely called "gridlat_0" and "gridlon_0", based on the "coordinates" attribute attached to your data. You will need to read these two arrays, and use them in the getind_latlon2d function: lat2d = fin->gridlat_0 lon2d = fin->gridlon_0 lat = 45 lon = 29 nm = getind_latlon2d(lat2d,lon2d, lat, lon) "nm(0,0)" will be the latitude index, and "nm(0,1)" will be the longitude index into the "gust" array: print(gust(nm(0,0),nm(0,1)) --Mary On Apr 18, 2014, at 8:44 AM, Yann Bertrand <yann74_at_yahoo.fr> wrote: > Hi, > How can I get a discrete value at a given point, > which is not necessarily on a grid point ? > Does NCL interpolate ? > I've tried this : > > ---------------------- > gust = fin->GUST_P0_L1_GLC0 > lat =45 > lon=29 > gust({lat},{lon}) > ---------------------- > > fatal:Dimension (xgrid_0) of (gust) does not have an associated coordinate variable > fatal:["Execute.c":7743]:Execute: Error occurred... > > Here's details on my var : > > Variable: gust > Type: float > Total Size: 4428 bytes >            1107 values > Number of Dimensions: 2 > Dimensions and sizes:  [ygrid_0 | 27] x [xgrid_0 | 41] > Coordinates: > Number Of Attributes: 14 >  center :      US National Weather Service - NCEP (WMC) >  production_status :  Operational products >  long_name :  Wind speed (gust) >  units :      m s-1 >  _FillValue :  1e+20 >  coordinates : gridlat_0 gridlon_0 >  grid_type :  Lambert Conformal can be secant or tangent, conical or bipolar >  parameter_discipline_and_category :  Meteorological products, Momentum >  parameter_template_discipline_category_number :      ( 0, 0, 2, 22 ) >  level_type :  Ground or water surface >  level :        0 >  forecast_time :      1 >  forecast_time_units : hours >  initial_time :        04/17/2014 (06:00) > (0,0)    0 > (0,1)    0 > (0,2)    0 > (0,3)  0.7... > > Thanks in advance for a reply, > Yann. > > _______________________________________________ > 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 May 5 05:32:17 2014

This archive was generated by hypermail 2.1.8 : Fri May 09 2014 - 15:23:17 MDT