[ncl-talk] Extracting data for a given point from a model output

Dennis Shea shea at ucar.edu
Mon Dec 28 14:52:59 MST 2020


As noted by Eshan, you want interpolation.
Please read the documentation for *rcm2points_Wrap*
<https://www.ncl.ucar.edu/Document/Functions/Contributed/rcm2points_Wrap.shtml>

Note: Temperature is NOT in the file.


  f     = *addfile*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml>("Yazd-2019_DUST01.2019010100.nc"
, "r")
  lat2d = f->xlat
  lon2d = f->xlon

  *printVarSummary*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/printVarSummary.shtml>(lat2d)
  *printMinMax*
<https://www.ncl.ucar.edu/Document/Functions/Contributed/printMinMax.shtml>(lat2d,
0)
  *printMinMax*
<https://www.ncl.ucar.edu/Document/Functions/Contributed/printMinMax.shtml>(lon2d,
0)

  stalat = 32.0               ;(/  32.0 ,  17.31, 24.05   /)   ; user
specified coordinate pairs
  stalon = 52.0               ; (/ 52.0 ,-101.00,-92.46   /)

  X = f->mixrat              ; (time, kz, iy, jx)
  Y = d->ddflx               ; (time, iy, jx)

  x = *rcm2points_Wrap*
<https://www.ncl.ucar.edu/Document/Functions/Contributed/rcm2points_Wrap.shtml>(lat2d,
lon2d, X, stalat, stalon, 0)
  y = *rcm2points_Wrap*
<https://www.ncl.ucar.edu/Document/Functions/Contributed/rcm2points_Wrap.shtml>(lat2d,
lon2d, Y, stalat, stalon, 0)

  print(x)

  print(y)


On Mon, Dec 28, 2020 at 12:10 PM Setareh Rahimi <setareh.rahimi at gmail.com>
wrote:

> Dear Dennis,
> Many thanks for your response. What I exactly mean is how to extract for
> example "Temperature variable" value for a specific lat/lon from the output
> result. For example: what is temperature value for a point at (lat=32, lon
> 52)?
> Thanks again
> Best wishes
>
> On Mon, Dec 28, 2020 at 10:17 PM Dennis Shea <shea at ucar.edu> wrote:
>
>> *getind_latlon2d *
>> <https://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml>
>>
>> A modification of Example 1
>>
>>  f     = *addfile* <https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml>("Yazd-2019_DUST01.2019010100.nc" , "r")
>>   lat2d = f->xlat
>>   lon2d = f->xlon
>>
>>   *printVarSummary* <https://www.ncl.ucar.edu/Document/Functions/Built-in/printVarSummary.shtml>(lat2d)
>>   *printMinMax* <https://www.ncl.ucar.edu/Document/Functions/Contributed/printMinMax.shtml>(lat2d, 0)
>>   *printMinMax* <https://www.ncl.ucar.edu/Document/Functions/Contributed/printMinMax.shtml>(lon2d, 0)
>>
>>   lat   = (/  31.0 ,  17.31, 24.05   /)   ; user specified coordinate pairs
>>   lon   = (/ -86.45,-101.00,-92.46   /)
>>                                           ; return 2d subscripts
>>   nm = *getind_latlon2d* (lat2d,lon2d, lat, lon)
>>
>>   *print* <https://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml>(nm)
>>
>>   X = f->mixrat              ; (time, kz, iy, jx)
>>   Y = d->ddflx               ; (time, iy, jx)
>>
>>   nt =     .... the index some specified time
>>
>>   kl =     ... index
>>
>>  do k=0,*dimsizes* <https://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml>(lat)-1
>>      n = nm(k,0)
>>      m = nm(k,1)
>>
>>      x = X(nt,kl,n,m)
>>      y = Y(nt,n,m)
>>
>>      *print* <https://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml>(lat2d(n,m)+"   "+lon2d(n,m)+"  "+x+"   "+y)
>>   end do
>>
>>
>>
>>
>> On Mon, Dec 28, 2020 at 10:16 AM Setareh Rahimi via ncl-talk <
>> ncl-talk at mailman.ucar.edu> wrote:
>>
>>> Dear all,
>>>
>>> I need to extract data (it could be any variable like temperature, wind
>>> ...) for a specific point (say synoptic stations) at a specific day and
>>> time
>>>  Yazd-2019_DUST01.2019010100.nc
>>> <https://drive.google.com/file/d/105vU4Hx2sRjvWlsmRBKOxa97kXp8Cx1_/view?usp=drive_web>
>>> ( Jan-03- 00:00 UTC), from a model output (file attached).  I wonder how
>>> it could be achieved using NCL (any example...) .
>>>
>>> I appreciate any suggestion,
>>> Best wishes,
>>> --
>>> S.Rahimi
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at mailman.ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
> --
> S.Rahimi
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201228/4cb8d809/attachment.html>


More information about the ncl-talk mailing list