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

Setareh Rahimi setareh.rahimi at gmail.com
Sat Jan 2 12:07:04 MST 2021


Dear Dennis,
Many thanks for your guide.
Best wishes,

On Thu, Dec 31, 2020 at 8:31 PM Dennis Shea <shea at ucar.edu> wrote:

> Oops, it was pointed out that I did not attach the script.
> Attached
>
>
> On Thu, Dec 31, 2020 at 8:33 AM Dennis Shea <shea at ucar.edu> wrote:
>
>> The attached prints the values of grid points surrounding the  940.504
>> values.
>>
>> (0) ==================
>> (0) n=2   m=2   LAT2D(n,m)=31.9429   LON2D(n,m)=51.921 EMFLX(n,m)=940.504
>> (0) ==================
>> (0)  116.882  267.648   93.284     13.129        0.019
>> (0)  406.997  579.607  570.014    403.070   34.221
>> (0)      0.000  724.817  *940.504* 1244.555  415.407
>> (0)      0.000    0.000    485.039 1189.545 1862.362
>> (0)      0.000    0.000    551.603  889.335  2226.263
>>
>>
>> as you can readily see, the flux is not 'smoothly varying'  due to 0's.
>> The 0s are treated a real values.
>> What should the plotted value be?  The raster and cell use multiple
>> values for the plotted value.
>> If you want, try the following
>>
>>
>> The variable(s) have no _FillValue attribute,
>>
>>     emflx = f->emflx
>>     emflx = where(emflx.eq.0.0, -999.0, emflx)   ; change 0.0 to -999.0
>>     emflx at _FillValue = -999.0                            ; assign
>> _FillValue attribute
>>     printVarSummary(emflx)
>>     printMinMax(emflx,0)
>>
>> Try this and plot the emflx
>>
>>
>>
>>
>> On Wed, Dec 30, 2020 at 11:39 AM Setareh Rahimi <setareh.rahimi at gmail.com>
>> wrote:
>>
>>> That attached was 'dry deposition flux', please ignore that, and have a
>>> look at the attached file.
>>> Thanks,
>>>
>>> On Wed, Dec 30, 2020 at 10:01 PM Setareh Rahimi <
>>> setareh.rahimi at gmail.com> wrote:
>>>
>>>> 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
>>>>
>>>>
>>>
>>> --
>>> S.Rahimi
>>>
>>>

-- 
S.Rahimi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210102/26a72f66/attachment.html>


More information about the ncl-talk mailing list