[ncl-talk] plotting I J variables from the WRF out file

Rick Brownrigg brownrig at ucar.edu
Mon May 11 21:53:07 MDT 2020


Hi,

Please always respond back to the mail-list -- there's a much broader pool
of expertise that can contribute.

I don't know what you mean by "one extra value at the end".  Is that one
too many lat/lon pairs?  A statement like loc=loc-1 would effectively
subtract 1 degree from all lat/lon pairs, thus translating your data. Do
you see anything plotted if you don't do this?

I don't know anything about the 2m air temperature, and this is where the
broader community comes into play.

Rick



On Mon, May 11, 2020 at 9:42 PM ali mughal <mughalali655 at gmail.com> wrote:

> Hi
> Thanks a lot for the help.
>
> Please see the attached corrected file which shows the data from
> zero_skipped.csv. However, there is one  extra value at the end of both lat
> and lons. When I use loc=loc-1 I don't see any data plotted. Please let me
> know if my procedure is correct.
>
> Second question is how can I extract the 2m air temperature at the same
> grid points as the values in zero_skipped.csv.
>
> Will be really grateful for the help
>
> On Tue, May 12, 2020 at 9:19 AM Rick Brownrigg <brownrig at ucar.edu> wrote:
>
>> Hi,
>>
>> I'm not surprised that no data is plotted. Again, you are treating the
>> 1st and 2nd columns of your zero_skipped file as lon/lat values. They look
>> like i,j indices to me, but conceivably could be lon/lats at 1 degree
>> boundaries. Regardless, they are values that are well outside the narrow
>> mpMin/Max/Lat/Lon values you've specified.
>>
>> I don't understand the lat_lons.ncl script, and can't run it because I
>> don't have the WRF file. However, if I understand what you are trying to
>> do, I think you need to open that WRF file in test_1.ncl, like you did in
>> lat_lons.ncl, and after you've read in and converted the variables "lon"
>> "lat", pass those into wrf_user_ij_ll, and use the results of that to set
>> the sfXArray/sfYArray resources. For clarity, I personally would rename the
>> variables lat/lon as read in from the ascii file to something more like "i"
>> "j" or "row" "col"
>>
>> Rick
>>
>> On Mon, May 11, 2020 at 5:29 PM ali mughal via ncl-talk <
>> ncl-talk at ucar.edu> wrote:
>>
>>> Dear NCL Team
>>>
>>> For the first question regarding modification to the code I did the
>>> attached changes (i.e. test1.ncl) though it shows the map where I intend to
>>> plot the data but still there is no data plotted. The I, j values in the
>>> csv I shared earlier and repeated here for convenience (zero_skipped.csv)
>>> correspond to the lat longs in the file (WRF_latlongs.xlsx).
>>>
>>> For the second question regarding the usage of wrf_user_ij_ll when I try
>>> to use this function like the way in the attached file (lat_lons.ncl) I get
>>> a segmentation fault (core dumped) message. However, if I don't use the
>>> script and copy these values directly into the ncl interface instead of
>>> submitting it in the form a script I get the values printed out. Please
>>> note that the I,j values printed here correspond to the same lat longs as
>>> in the file (WRF_lotlongs.xlsx).
>>>
>>> Regards
>>>
>>> On Tue, May 12, 2020 at 3:15 AM Dennis Shea <shea at ucar.edu> wrote:
>>>
>>>> Actually, it is not quite clearer what you are looking for:
>>>>
>>>> As indicated by Rick  *wrf_user_ij_to_ll*
>>>> <https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_ij_to_ll.shtml>
>>>>
>>>> other possibilities include the following very similar functions:
>>>>
>>>> *region_ind*
>>>> <https://www.ncl.ucar.edu/Document/Functions/Contributed/region_ind.shtml>
>>>> and  *getind_latlon2d*
>>>> <https://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml>
>>>>
>>>> *You* must experiment. Please use print statements like *printVarSummary
>>>> *while debugging.
>>>> The output from *printVarSummary *is for you to look at to examine
>>>> variable type and shape, etc.
>>>>
>>>> On Sun, May 10, 2020 at 7:45 PM Rick Brownrigg via ncl-talk <
>>>> ncl-talk at ucar.edu> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Please do not reply directly back to me, but rather to the group as a
>>>>> whole -- they provide a broader pool of expertise to draw upon.
>>>>>
>>>>> I *think* wrf_user_ij_to_ll work() will do what you want, but it will
>>>>> likely require some experimentation. Liberal use of printVarSummary() is
>>>>> your best friend ;-)
>>>>>
>>>>> Rick
>>>>>
>>>>>
>>>>>
>>>>> On Sun, May 10, 2020 at 3:03 PM ali mughal <mughalali655 at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Dear Rick
>>>>>>
>>>>>> Thanks for the reply.
>>>>>>
>>>>>> In continuation to my previous email, I asked that in the shared the
>>>>>> first two columns represent I,j values of the WRF grid. If i have to
>>>>>> evaluate 2m air temperature on the same I,j values will wrf_user_ij_to_ll
>>>>>> work or do I need to use some other method.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> On Sunday, May 10, 2020, Rick Brownrigg <brownrig at ucar.edu> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> There are at least two problems. One is that str_get_field() returns
>>>>>>> strings, and so "data" in the call to gsn_csm_contour_map() is a string,
>>>>>>> and this is the source of the error message. Try adding these 3 lines:
>>>>>>>
>>>>>>> lat := stringtofloat(lat)
>>>>>>> lon := stringtofloat(lon)
>>>>>>> data := stringtofloat(data)
>>>>>>>
>>>>>>> The other problem is that the min/max bounds are inappropriate for
>>>>>>> the data -- I get a blank plot. If I used the true min/max I get a mostly
>>>>>>> centered over Siberia:
>>>>>>>
>>>>>>> res at mpMinLatF = min(lat) ;-6.080154 ; range to zoom in on
>>>>>>> res at mpMaxLatF = max(lat) ;10.04061
>>>>>>> res at mpMinLonF = min(lon) ;95.908
>>>>>>> res at mpMaxLonF = max(lon) ;112.092
>>>>>>>
>>>>>>> Finally, the values for lat/lon in the file look suspect -- is this
>>>>>>> really a 1-degree grid? I might have guessed they are row/column values.
>>>>>>>
>>>>>>> Good luck,
>>>>>>> Rick
>>>>>>>
>>>>>>>
>>>>>>> On Sun, May 10, 2020 at 2:23 AM ali mughal via ncl-talk <
>>>>>>> ncl-talk at ucar.edu> wrote:
>>>>>>>
>>>>>>>> Dear Users
>>>>>>>>
>>>>>>>> I have csv file attached with the data available at specific grids
>>>>>>>> of the WRF outfile.Could any one help how to correct my attached code in
>>>>>>>> NCL?
>>>>>>>>
>>>>>>>> When I try to run the code, I get the following error message
>>>>>>>>
>>>>>>>> (0)     This file has 4825 rows and 3 columns.
>>>>>>>> fatal:Argument type mismatch on argument (1) of
>>>>>>>> (gsn_csm_contour_map) can not coerce
>>>>>>>> fatal:["Execute.c":8578]:Execute: Error occurred at or near line 64
>>>>>>>> in file test_1.ncl
>>>>>>>>
>>>>>>>>
>>>>>>>> Later I want to use the same code to be modified to calculate 2m
>>>>>>>> air temperature at the same I J grids.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> _______________________________________________
>>>>>>>> ncl-talk mailing list
>>>>>>>> ncl-talk at ucar.edu
>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>
>>>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200511/0078eba2/attachment.html>


More information about the ncl-talk mailing list