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

Setareh Rahimi setareh.rahimi at gmail.com
Wed Dec 30 11:31:01 MST 2020


Dear Dennis,
This is something weird to me, too.I attached a plot of output model for
the same date. Comparing  the plot with the value for that lat/lon, results
do not match together. What is your idea?
Many thanks again,
Best wishes,

On Wed, Dec 30, 2020 at 7:09 PM Dennis Shea <shea at ucar.edu> wrote:

> ????  does not return the value of the emflx variable for the desired
> point (lat/lon)
>
> Well, what is the "correct value" ?
> ======
>
>   lat = 32.0
>   lon = 52.0
>
> (0) ==================
> (0) n=21   m=8   lat2d(n,m)=31.9429   lon2d(n,m)=51.921   *<====This is
> the closest grid point ... pretty close!!!*
> (0) ==================
>
> (5) 605628   ymdh=2019010212
> (6) 605634   ymdh=2019010218
> *(7)* 605640   ymdh=*2019010300    <===  NT=7*
> (8) 605646   ymdh=2019010306
> (9) 605652   ymdh=2019010312
>
>   *YMDH   = 2019010300 *            ; user specified
>   print("YMDH="+YMDH)
>   NT     = ind(ymdh .eq. YMDH)
>   print("NT="+NT+" ymdh(NT)="+ymdh(NT) )
>
>
> *(0) YMDH=2019010300(0) NT=7 ymdh(NT)=2019010300*
> (0) ==================
>
>   EMFLX = f->emflx
>   emflx = EMFLX(NT,n,m)           ; scalar
>   print("==================")
>   print( emflx )                 ;  ====
>
> (0) 940.5043
>
> On Wed, Dec 30, 2020 at 8:15 AM Setareh Rahimi <setareh.rahimi at gmail.com>
> wrote:
>
>> Dear Dennis,
>> Thanks again for your guide. However, after running the code I noticed
>> that  Y = f->emflx(NT,n,m)   does not return the value of the emflx
>> variable for the desired point (lat/lon).
>> May I ask you please to give me more advice in this regard?
>> Best wishes,
>>
>> On Tue, Dec 29, 2020 at 3:22 AM Dennis Shea <shea at ucar.edu> wrote:
>>
>>> I think we have been through this before. There are many *time/date
>>> functions.* <https://www.ncl.ucar.edu/Document/Functions/date.shtml>
>>>
>>>    time  = f->time   ; hours since 1949-12-01 00:00:00 UTC"
>>> ; [1]
>>>    TIME     = *cd_calendar*
>>> <https://www.ncl.ucar.edu/Document/Functions/Built-in/cd_calendar.shtml>(time,
>>> 0)      ; PLEASE read the documentation
>>>    year      = toint( TIME(:,0) )               ; toint strips meta data
>>>    month   = toint( TIME(:,1) )
>>>    day       = toint( TIME(:,2) )               ; day of month
>>>    hour      = toint( TIME(:,3) )               ; hour of day
>>>    minute  = toint( TIME(:,4) )
>>>    second  = toint( TIME(:,5) )
>>>
>>>
>>> ;[2]
>>>   ymdh  =  *yyyymmddhh_time*
>>> <https://www.ncl.ucar.edu/Document/Functions/Contributed/yyyymmddhh_time.shtml>(time,
>>> -3)  ; PLEASE read the documentation
>>>
>>>   YMDH       = 2019010300
>>>   nt        =* ind*
>>> <https://www.ncl.ucar.edu/Document/Functions/Built-in/ind.shtml>(ymdh
>>> .eq. YMDH)
>>> ================================================================
>>> A simple script is attached.
>>> ================================================================
>>>
>>> %> ncl setareh.ncl
>>>
>>> Please Look-at/READ the documentation of the functions used
>>>
>>> On Mon, Dec 28, 2020 at 3:04 PM Setareh Rahimi <setareh.rahimi at gmail.com>
>>> wrote:
>>>
>>>>
>>>> Dear Dennis,
>>>> I am not looking for interpotation, temperature was just an example.
>>>> Emflx is one of the varibles in the file. I need to know for say
>>>> Jan-03-00:00UTC , what is the value of emflx for a specific point .
>>>> Best wishes,
>>>> On Tue, Dec 29, 2020 at 01:23 Dennis Shea <shea at ucar.edu> wrote:
>>>>
>>>>> 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
>>>>>>
>>>>>> --
>>>> S.Rahimi
>>>>
>>>>
>>
>> --
>> S.Rahimi
>>
>>

-- 
S.Rahimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201230/155f5aa7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rcm_2019010300.png
Type: image/png
Size: 88087 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201230/155f5aa7/attachment.png>


More information about the ncl-talk mailing list