[ncl-talk] Regridding WRF corvilinear grid to gpm rain rectlinear grid

Mary Haley haley at ucar.edu
Mon Dec 4 13:06:37 MST 2017


If you have follow-up questions, please post them back to ncl-talk and not
to NCL developers directly, unless we specifically ask you to take it
offline.

The problem is that you have these two resources set to False, which
effectively turns off any plotting:

   res at gsnDraw               = False
   res at gsnFrame              = False

They were set to False because the original script was later paneling the
two plots together. Since you are just drawing one plot and not paneling
it, you don't want to set these at all. Just comment them out or remove
them.

You also don't want to turn off the labelbar, *and* you don't want to set
the contour levels based in your "rain" data, because you are plotting the
difference. To fix these issues, comment or remove these lines:

   res at lbLabelBarOn          = False    ; Turn on later in panel

;---Fix the contour levels across all time steps
    mnmxint = nice_mnmxintvl( min(rain), max(rain), 18, False)
    res at cnLevelSelectionMode = "ManualLevels"
    res at cnMinLevelValF       = mnmxint(0)
    res at cnMaxLevelValF       = mnmxint(1)
    res at cnLevelSpacingF      = mnmxint(2)

If you have more plotting questions, please read over the excellent DKRZ
guide on NCL:

http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/

There are also hundreds of examples on our plotting examples page:

http://www.ncl.ucar.edu/Applications/

--Mary


On Mon, Dec 4, 2017 at 12:11 PM, Ronald Opio <opioronald123 at gmail.com>
wrote:

> Hello Mary.  Thank you for assisting me.
>
> It has worked well very well.
>
> I have a small request though. Using the same data, I am trying to
> calculate the difference and plot it, however, the script am using is not
> generating any output.
>
> Please help me take a look at it. I have attached it.
>
> Sincerely,
>
> Ronald.
>
> On Mon, Dec 4, 2017 at 7:58 PM, Mary Haley <haley at ucar.edu> wrote:
>
>> Ronald,
>>
>> It always helps to look at things graphically if the regridding is not
>> working. Also, you really need to look more closely at your data, because
>> several time steps had all constant data.
>>
>> I'm not sure what you are saying is wrong about the regridding.
>>
>> I have a template for creating a panel plot of original data and
>> regridded data, so I used this on your data.
>>
>> There are some things to note:
>>
>> [1] Your regridded data is in a smaller area than the original data, so
>> obviously you cannot fully regrid the original data.
>>
>> [2] You probably don't want to use bilinear interpolation to regrid
>> precipitation data.  "Conserve" might be a better match.
>>
>> [3] For some of your time steps, the rain data is all constant.
>>
>> To check if it was constant across all time steps, I created an
>> animation. I then realized that your precipitation data is very sparse and
>> most of the "interesting" parts are happening outside the area that you are
>> regridding to, so this makes for several plots that are all one color. I
>> then decided to try regridding temperature instead, to make sure things
>> were working.
>>
>> See the attached trial_mod.ncl, which is your regridding script with
>> plotting added. This script regrids temperature instead of precipitation.
>> As you can see from the attached animation, the regridding appears to be
>> working.
>>
>> If you try to regrid rain, you will see that the plot is not very
>> interesting. This is because I haven't made the effort to pick better
>> levels for precipitation.  You can take this script and modify it for your
>> own purposes.
>>
>> --Mary
>>
>>
>> On Mon, Dec 4, 2017 at 12:55 AM, Ronald Opio <opioronald123 at gmail.com>
>> wrote:
>>
>>> Hello Dennis.
>>>
>>> I have tried this and am still experiencing the same problem. No change
>>> is happening to the file I want to re-grid.
>>>
>>> Please have a look at it and see. I have attached the wrf file as a
>>> google drive link plus the script am using and the GPM rainfall file (
>>> precip.nc).
>>>
>>> My intention is to regrid the wrf file so that it has the same
>>> dimensions as the precip file.
>>>
>>> Please help out.
>>>
>>> Sincerely,
>>>
>>> Ronald.​
>>>  wrf.nc
>>> <https://drive.google.com/file/d/1DEV9Kdp3VRH-7oHtBjNfvqhdyvY-9ABj/view?usp=drive_web>
>>>>>>
>>> On Wed, Nov 29, 2017 at 7:34 PM, Dennis Shea <shea at ucar.edu> wrote:
>>>
>>>> regridding:   I am not sure what you mean by:
>>>>   "It runs well, however, when I check the file after, I find that the
>>>> WRF file still remains with its original grid size."
>>>>
>>>> ===
>>>> *The original file is never overwritten*.
>>>> ===
>>>> Suggestion:
>>>>     rain = r1 + r2     ; all meta data is lost
>>>>     rain at long_name = "Total Rain"              ; whatever
>>>>     rain at units = r1 at units
>>>>     copy_VarCoords(r1, rain)
>>>>
>>>> ---
>>>>    raingrid = ESMF_regrid(rain,Opt) ; Regrid "rain" to new grid
>>>>    printVarSummary(raingrd)
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, Nov 29, 2017 at 8:14 AM, Barry Lynn <barry.h.lynn at gmail.com>
>>>> wrote:
>>>>
>>>>> Hi:
>>>>>
>>>>> Do you mean how to make single maps, or do you mean how to turn a pdf
>>>>> or pngs into a gif?
>>>>>
>>>>> On Wed, Nov 29, 2017 at 2:52 PM, Ronald Opio <opioronald123 at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Thank you Barry. Let me give this a try.
>>>>>>
>>>>>> Could you be having a script for animating total precipitation in
>>>>>> this way https://www.youtube.com/watch?v=SW1rA-M6l4s ?
>>>>>>
>>>>>> If so, please share with me.
>>>>>>
>>>>>> Sincerely,
>>>>>>
>>>>>> Ronald.
>>>>>>
>>>>>> On Wed, Nov 29, 2017 at 2:24 PM, Barry Lynn <barry.h.lynn at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Dear Ronald:
>>>>>>>
>>>>>>> I have used regrid to regrid to both the original WRF grid and a
>>>>>>> more sparse grid.  However, its main task is to regrid to the original grid
>>>>>>> in rectilinear coordinates (unless you tell it otherwise).
>>>>>>>
>>>>>>> You can interpolate from a fine grid to a coarse grid using the
>>>>>>> programs available (e.g., area_hi2lores_Wrap).
>>>>>>>
>>>>>>> Please see lines 320,386 in the program attached (that calculates
>>>>>>> frontogenesis).  In this program, I used a more sparse version of the WRF
>>>>>>> grid as the destination grid. If you are going to use a grid from a
>>>>>>> different data set, then it would be best if the new grid will be smaller
>>>>>>> than the WRF grid (so you don't interpolate zeros).
>>>>>>>
>>>>>>> Barry
>>>>>>>
>>>>>>> On Wed, Nov 29, 2017 at 11:16 AM, Ronald Opio <
>>>>>>> opioronald123 at gmail.com> wrote:
>>>>>>>
>>>>>>>> Hello colleagues.
>>>>>>>>
>>>>>>>> I am trying to regrid my WRF output file so as to match the gpm
>>>>>>>> rainfall data set grid, however the script is not working.
>>>>>>>>
>>>>>>>> I am using ESMF_regrid function. It runs well, however, when I
>>>>>>>> check the file after, I find that the WRF file still remains with its
>>>>>>>> original grid size.
>>>>>>>>
>>>>>>>> Please help me out. What could the problem be?
>>>>>>>>
>>>>>>>> I have attached the script herein.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Ronald.
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> ncl-talk mailing list
>>>>>>>> ncl-talk at ucar.edu
>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Barry H. Lynn, Ph.D
>>>>>>> Senior Lecturer,
>>>>>>> The Institute of the Earth Science,
>>>>>>> The Hebrew University of Jerusalem,
>>>>>>> Givat Ram, Jerusalem 91904, Israel
>>>>>>> Tel: 972 547 231 170
>>>>>>> Fax: (972)-25662581
>>>>>>>
>>>>>>> C.E.O, Weather It Is, LTD
>>>>>>> Weather and Climate Focus
>>>>>>> http://weather-it-is.com
>>>>>>> Jerusalem, Israel
>>>>>>> Local: 02 930 9525
>>>>>>> Cell: 054 7 231 170
>>>>>>> Int-IS: x972 2 930 9525
>>>>>>> US 914 432 3108 <(914)%20432-3108>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Barry H. Lynn, Ph.D
>>>>> Senior Lecturer,
>>>>> The Institute of the Earth Science,
>>>>> The Hebrew University of Jerusalem,
>>>>> Givat Ram, Jerusalem 91904, Israel
>>>>> Tel: 972 547 231 170
>>>>> Fax: (972)-25662581
>>>>>
>>>>> C.E.O, Weather It Is, LTD
>>>>> Weather and Climate Focus
>>>>> http://weather-it-is.com
>>>>> Jerusalem, Israel
>>>>> Local: 02 930 9525
>>>>> Cell: 054 7 231 170
>>>>> Int-IS: x972 2 930 9525
>>>>> US 914 432 3108 <(914)%20432-3108>
>>>>>
>>>>> _______________________________________________
>>>>> 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/20171204/89d452a4/attachment.html>


More information about the ncl-talk mailing list