[ncl-talk] Vorticity Advection with NCL

Lara Quitián Hernández laraquitianhernandez at gmail.com
Wed May 23 04:30:14 MDT 2018


Thank you so much. I was absolutely wrong and I did not realize my mistake.

I attach here my script because I'm still obtaining errors and I'm afraid I
do not fully understand the procedure of the different calculations. For
example, I do not know if I have to generate a weight file for regridding
the relative vorticity (wr) or which name give to that weight file
(Opt at WgtFileName). Moreover, I do not know why do I have to use the
relative vorticity and not the absolute vorticity to study the vorticity
advection at the end.

On the other hand, I will also ftp a WRF file and my script.

Thanks in advance.

Regards,
Lara


2018-05-22 17:40 GMT+02:00 Adam Phillips <asphilli at ucar.edu>:

> Hi Lara,
> You are passing in your original data into advect_variable instead of the
> regridded variables. Change this:
>  adv_vrt = advect_variable(u, v, wr, 1, "vorticity advection",
> "(m/s)(s-1)",0)
> to this:
>  adv_vrt = advect_variable(u_reclin, v_reclin, wr_reclin, 1, "vorticity
> advection", "(m/s)(s-1)",0)
>
> Gaussian grids are indeed rectlinear grids. See the definition here:
> https://www.ncl.ucar.edu/Document/glossary.shtml#RectilinearGrid
>
> If you have any further questions please respond to ncl-talk.
> Adam
>
> On Tue, May 22, 2018 at 7:24 AM, Lara Quitián Hernández <
> laraquitianhernandez at gmail.com> wrote:
>
>> First of all, I apologize for asking you so many questions and for this
>> long email.
>>
>> I'm trying to interpolate the WRF u,v, relative vorticity to a
>> rectilinear grid and use the *advect_variable* on the rectilinear grid.
>> However, I have obtained this warning and I do not know how to fixed it: *advect_var:
>> Warning: No named dimensions. Can not check grid order.*
>>
>> After defining the diverse variables, I have performed the regrid in this
>> way:
>>
>>
>> *;================================================================================*
>> *; Part A: WRF (curvilinear) to Rectilinear regrid variable and generate
>> weights *
>>
>> *;================================================================================*
>>
>> *;Interpolate the WRF u, v and relative vorticity to a rectilinear grid
>> with as fine [or finer] resoultion as the WRF grid*
>>
>>
>> *;---Set up options for regridding*
>>
>> *    InterpMethod= "bilinear"                    ; define interpolation
>> method*
>>
>> *;---Title and filename options*
>>
>> *    Opt                = True*
>> *    Opt at SrcTitle       = "WRF grid"   ; optional*
>> *    Opt at WgtFileName    =
>> "WRF_to_Rect.WgtFile_"+InterpMethod+"."+nlat+"_x_"+nlon+".nc"*
>>
>> *;---Source grid options*
>> *    Opt at SrcFileName    =
>> "WRF.SCRIP_grid_description."+nlat+"_x_"+nlon+".nc"  ; Name of source and*
>> *    Opt at SrcRegional    = True*
>> *    Opt at SrcGridLat     = lat2d*
>> *    Opt at SrcGridLon     = lon2d*
>>
>> *;---Destination grid options*
>> *    Opt at DstFileName    =
>> "Rectilinear.SCRIP_grid_description."+nlat+"_x_"+nlon+".nc" ; destination
>> files*
>> *    Opt at DstGridType    = "rectilinear"*
>> *    Opt at DstGridLat     = lat*
>> *    Opt at DstGridLon     = lon*
>> *    Opt at DstRegional    = True*
>>
>> *;---Specify other options  *
>> *    Opt at ForceOverwrite = True*
>> *    Opt at InterpMethod   = InterpMethod*
>>
>> *;---Perform the regrid: WRF ==> rectilinear (_reclin)*
>> *    u_reclin = ESMF_regrid(u, Opt)     ; Do the regridding for u   *
>>
>> *;---Use the just generated weight file*
>> *    v_reclin = ESMF_regrid_with_weights(v,Opt at WgtFileName,False)*
>>
>> *;---Perform the regrid for wr: WRF ==> rectilinear (_reclin)*
>> *    wr_reclin = ESMF_regrid_with_weights(wr, Opt at WgtFileName,False)  *
>>
>> Afterwards, I use the *advect_variable:*
>>
>> ;======================================================================
>> ;Use 'advect_variable' on the rectilinear grid
>> ;======================================================================
>>
>>    adv_vrt = advect_variable(u, v, wr, 1, "vorticity advection",
>> "(m/s)(s-1)",0)   ;I use gridType=1. I suppose rectilinear and fixed grid
>> are quite similar, or even, the same.
>>
>>   printVarSummary(adv_vrt)
>>   printMinMax(adv_vrt,0)
>>   print("----")
>>
>> Finally, I obtain this results and I do not know if they are correctly
>> calculated:
>>
>> *Variable: u_reclin*
>> *Type: float*
>> *Total Size: 5972400 bytes*
>> *            1493100 values*
>> *Number of Dimensions: 3*
>> *Dimensions and sizes: [bottom_top | 35] x [lat | 180] x [lon | 237]*
>> *Coordinates: *
>> *            lat: [25.832275390625..40.83070373535156]*
>> *            lon: [-34.179443359375..-9.305511474609375]*
>> *Number Of Attributes: 8*
>> *  missing_value : 9.96921e+36*
>> *  remap : remapped via ESMF_regrid_with_weights: Bilinear*
>> *  _FillValue : 9.96921e+36*
>> *  stagger :  *
>> *  units : m s-1*
>> *  description : x-wind component*
>> *  MemoryOrder : XYZ*
>> *  FieldType : 104*
>> *(0) u_reclin: min=-21.454   max=49.9299*
>> *(0) ----*
>>
>> *Variable: v_reclin*
>> *Type: float*
>> *Total Size: 5972400 bytes*
>> *            1493100 values*
>> *Number of Dimensions: 3*
>> *Dimensions and sizes: [bottom_top | 35] x [lat | 180] x [lon | 237]*
>> *Coordinates: *
>> *            lat: [25.832275390625..40.83070373535156]*
>> *            lon: [-34.179443359375..-9.305511474609375]*
>> *Number Of Attributes: 8*
>> *  _FillValue : 9.96921e+36*
>> *  stagger :  *
>> *  units : m s-1*
>> *  description : y-wind component*
>> *  MemoryOrder : XYZ*
>> *  FieldType : 104*
>> *  remap : remapped via ESMF_regrid_with_weights: Bilinear*
>> *  missing_value : 9.96921e+36*
>> *(0) v_reclin: min=-51.6305   max=46.8953*
>> *(0) ----*
>>
>> *Variable: wr_reclin*
>> *Type: float*
>> *Total Size: 5972400 bytes*
>> *            1493100 values*
>> *Number of Dimensions: 3*
>> *Dimensions and sizes: [35] x [lat | 180] x [lon | 237]*
>> *Coordinates: *
>> *            lat: [25.832275390625..40.83070373535156]*
>> *            lon: [-34.179443359375..-9.305511474609375]*
>> *Number Of Attributes: 3*
>> *  _FillValue : 9.96921e+36*
>> *  remap : remapped via ESMF_regrid_with_weights: Bilinear*
>> *  missing_value : 9.96921e+36*
>> *(0) wr_reclin: min=-34.6481   max=63.9581*
>> *(0) ----*
>> *(0) RectilinearGrid: nmsg=180075*
>> *(0) ----*
>> *(0) advect_var: Warning: No named dimensions. Can not check grid order.*
>>
>> *Variable: adv_vrt*
>> *Type: float*
>> *Total Size: 5972400 bytes*
>> *            1493100 values*
>> *Number of Dimensions: 3*
>> *Dimensions and sizes: [35] x [180] x [237]*
>> *Coordinates: *
>> *Number Of Attributes: 2*
>> *  long_name : vorticity advection*
>> *  units : (m/s)(s-1)*
>> *(0) vorticity advection ((m/s)(s-1)) : min=-0.0107484   max=0.0109576*
>>
>> Unfortunately, I also obtain this errors:
>>
>> (0) is_SCRIP: 'Rectilinear.SCRIP_grid_description.nc' doesn't exist.
>> (0) ESMF_regrid_gen_weights: invalid or missing SCRIP source grid file.
>>
>> And I obtain this three files:
>>
>>
>> *Rectilinear.SCRIP_grid_description.180_x_237.nc
>> <http://Rectilinear.SCRIP_grid_description.180_x_237.nc>*
>>
>> *WRF.SCRIP_grid_description.180_x_237.nc
>> <http://WRF.SCRIP_grid_description.180_x_237.nc>*
>> *WRF_to_Rect.WgtFile_bilinear.180_x_237.nc
>> <http://WRF_to_Rect.WgtFile_bilinear.180_x_237.nc>*
>>
>> Which file do I have to use to display the vorticity advection? None, I
>> suppose. They are all description files, except one.
>>
>> If you need my script, just tell me.
>>
>> Thanks in advance.
>>
>> Regards,
>> Lara
>>
>>
>> 2018-05-22 11:08 GMT+02:00 Lara Quitián Hernández <
>> laraquitianhernandez at gmail.com>:
>>
>>> Good morning,
>>>
>>> Thank you very much. There is only one doubt left unanswered: the *advect_function
>>> *requires a *Gaussian, regular o fixed grid*, but not *rectilinear*. Is
>>> there any relation between them?
>>>
>>> Regards,
>>> Lara
>>>
>>> 2018-05-21 19:21 GMT+02:00 Dennis Shea <shea at ucar.edu>:
>>>
>>>> ESMF 37 was
>>>> (a)  interpolating u and v onto a rectilinear grid;
>>>> (b)  calculating divergence using uv2dv_cfd which requires u and v to
>>>> be on a rectilinear grid;
>>>> (c)  interpolating the derived divergence on a rectilinear grid back
>>>> onto the original WRF grid
>>>>
>>>> ---
>>>> In your case:
>>>>
>>>> [1] Interpolate the WRF u, v and relative vorticity to a rectilinear
>>>> grid with as fine [or finer] resoultion as the WRF grid
>>>> [2] Use 'advect_variable' on the rectilinear grid
>>>> [3] interpolate the advected quantity on the rectilinear grid back onto
>>>> the original WRF grid
>>>>
>>>> ---
>>>> Caveat: Technically, on a sphere,  u and v must be interpolated
>>>> together using the 'rotation' angle.
>>>> Why? because the new location has a 'slightly' different orientation
>>>> relative to the pole(s)
>>>>
>>>>   unew        = u*cos(rot) - v*sin(rot)
>>>>   vnew        = u*sin(rot) + v*cos(rot)
>>>>
>>>> The above approach, independently interpolating u and v ignores the
>>>> rotation. It is assumed to be very small.
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, May 21, 2018 at 3:45 AM, Lara Quitián Hernández <
>>>> laraquitianhernandez at gmail.com> wrote:
>>>>
>>>>> Good morning,
>>>>>
>>>>> Thank you so much. Unfortunately, I have some doubts.
>>>>>
>>>>> 1.- I have read the information for Example 37 but I do not understand
>>>>> the need of computing the divergence ("uv2dv_cfd"). I just need my
>>>>> variables on a Gaussian, regular o fixed grid in order to apply the
>>>>> *advect_variable* function
>>>>> 2.- I need to convert my curvilinear WRF grid to a Gaussian, regular o
>>>>> fixed grid. However, in both Examples (29a and 37) a regrid from a WRF grid
>>>>> to a rectilinear grid is carried out. Are those grids (Gaussian, regular o
>>>>> fixed grid) also rectilinear grids?
>>>>> 3.-Do I need to regrid back to the WRF curvilinear grid as it is done
>>>>> in both examples?
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>> Regards,
>>>>> Lara
>>>>>
>>>>>
>>>>>
>>>>> 2018-05-20 1:10 GMT+02:00 Dennis Shea <shea at ucar.edu>:
>>>>>
>>>>>> NCL has no builtin function to advect a field (eg: vorticity) on a
>>>>>> curvilinear grid (eg: your WRF Grid)..
>>>>>> Maybe ask wrfhelp?
>>>>>>
>>>>>> ===
>>>>>> That said
>>>>>>
>>>>>> https://www.ncl.ucar.edu/Applications/ESMF.shtml
>>>>>> Example 29a
>>>>>> or, maybe better,
>>>>>> Example 37
>>>>>>
>>>>>> outlines a method that might be used for your needs.
>>>>>>
>>>>>> ===
>>>>>> Good luck
>>>>>>
>>>>>>
>>>>>> On Wed, May 16, 2018 at 7:40 AM, Lara Quitián Hernández <
>>>>>> laraquitianhernandez at gmail.com> wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> Thank you. In the case of calculating the horizontal advection for
>>>>>>> *vorticity*, it would be better to use the direct WRF variable ( vo
>>>>>>> = wrf_user_getvar(a,"*avo*",-1)) or define it via different
>>>>>>> functions: https://www.ncl.ucar.edu/Applications/vort.shtml
>>>>>>>
>>>>>>> The only example in the link defines the Vorticity like this:
>>>>>>>
>>>>>>> ;************************************************
>>>>>>> ; calculate vorticity on a Gaussian Grid
>>>>>>> ; scale for visual convenience
>>>>>>> ;************************************************
>>>>>>>   scale = 1.e05
>>>>>>>   vrt   = u                                      ; retain coordinates
>>>>>>>   vrt   = uv2vrG_Wrap(u,v) * scale
>>>>>>>   vrt at long_name = "vorticity"
>>>>>>>   vrt at units     = "scaled"
>>>>>>>
>>>>>>>
>>>>>>> However, my simulations are generated on a Lambert Conformal grid
>>>>>>> projection, not Gaussian one. Does this change the procedure to calculate
>>>>>>> it?
>>>>>>>
>>>>>>> Regards,
>>>>>>> Lara
>>>>>>>
>>>>>>> 2018-05-16 14:28 GMT+02:00 Dennis Shea <shea at ucar.edu>:
>>>>>>>
>>>>>>>> Maybe:
>>>>>>>>
>>>>>>>> https://www.ncl.ucar.edu/Document/Functions/Contributed/adve
>>>>>>>> ct_variable.shtml
>>>>>>>>
>>>>>>>> 'x' would be vorticity
>>>>>>>>
>>>>>>>> Good Luck
>>>>>>>>
>>>>>>>> On Wed, May 16, 2018 at 4:01 AM, Lara Quitián Hernández <
>>>>>>>> laraquitianhernandez at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Good morning,
>>>>>>>>>
>>>>>>>>> I would like to know if there is a possibility of calculating the
>>>>>>>>> Vorticity Advection with NCL.
>>>>>>>>>
>>>>>>>>> Thanks in advance.
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Lara
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> *Lara Quitián Hernández, PhD Student*
>>>>>>>>> Departamento de Física de la Tierra, Astronomía y Astrofísica
>>>>>>>>> Facultad de Ciencias Físicas
>>>>>>>>> Ciudad Universitaria, Plaza Ciencias, 1
>>>>>>>>> <https://maps.google.com/?q=Ciudad+Universitaria,+Plaza+Ciencias,+1+28040+Madrid.+Spain&entry=gmail&source=g>
>>>>>>>>> 28040 Madrid. Spain
>>>>>>>>> <https://maps.google.com/?q=Ciudad+Universitaria,+Plaza+Ciencias,+1+28040+Madrid.+Spain&entry=gmail&source=g>
>>>>>>>>> Email: lquitian at ucm.es <mlunar at aemet.es>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> ncl-talk mailing list
>>>>>>>>> ncl-talk at ucar.edu
>>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>>
>>>>>>> *Lara Quitián Hernández, PhD Student*
>>>>>>> Departamento de Física de la Tierra, Astronomía y Astrofísica
>>>>>>> Facultad de Ciencias Físicas
>>>>>>> Ciudad Universitaria, Plaza Ciencias, 1
>>>>>>> <https://maps.google.com/?q=Ciudad+Universitaria,+Plaza+Ciencias,+1+28040+Madrid.+Spain&entry=gmail&source=g>
>>>>>>> 28040 Madrid. Spain
>>>>>>> <https://maps.google.com/?q=Ciudad+Universitaria,+Plaza+Ciencias,+1+28040+Madrid.+Spain&entry=gmail&source=g>
>>>>>>> Email: lquitian at ucm.es <mlunar at aemet.es>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>>
>>>>> *Lara Quitián Hernández, PhD Student*
>>>>> Departamento de Física de la Tierra, Astronomía y Astrofísica
>>>>> Facultad de Ciencias Físicas
>>>>> Ciudad Universitaria, Plaza Ciencias, 1
>>>>> <https://maps.google.com/?q=Plaza+Ciencias,+1+28040+Madrid.+Spain&entry=gmail&source=g>
>>>>> 28040 Madrid. Spain
>>>>> <https://maps.google.com/?q=Plaza+Ciencias,+1+28040+Madrid.+Spain&entry=gmail&source=g>
>>>>> Email: lquitian at ucm.es <mlunar at aemet.es>
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>>
>>>
>>> *Lara Quitián Hernández, PhD Student*
>>> Departamento de Física de la Tierra, Astronomía y Astrofísica
>>> Facultad de Ciencias Físicas
>>> Ciudad Universitaria, Plaza Ciencias, 1
>>> <https://maps.google.com/?q=Plaza+Ciencias,+1+28040+Madrid.+Spain&entry=gmail&source=g>
>>> 28040 Madrid. Spain
>>> <https://maps.google.com/?q=Plaza+Ciencias,+1+28040+Madrid.+Spain&entry=gmail&source=g>
>>> Email: lquitian at ucm.es <mlunar at aemet.es>
>>>
>>>
>>
>>
>> --
>>
>>
>> *Lara Quitián Hernández, PhD Student*
>> Departamento de Física de la Tierra, Astronomía y Astrofísica
>> Facultad de Ciencias Físicas
>> Ciudad Universitaria, Plaza Ciencias, 1
>> <https://maps.google.com/?q=Plaza+Ciencias,+1+28040+Madrid.+Spain&entry=gmail&source=g>
>> 28040 Madrid. Spain
>> <https://maps.google.com/?q=Plaza+Ciencias,+1+28040+Madrid.+Spain&entry=gmail&source=g>
>> Email: lquitian at ucm.es <mlunar at aemet.es>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>



-- 


*Lara Quitián Hernández, PhD Student*
Departamento de Física de la Tierra, Astronomía y Astrofísica
Facultad de Ciencias Físicas
Ciudad Universitaria, Plaza Ciencias, 1
28040 Madrid. Spain
Email: lquitian at ucm.es <mlunar at aemet.es>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180523/629e099f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ESMF37_VortAdv.ncl
Type: application/octet-stream
Size: 9197 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180523/629e099f/attachment.obj>


More information about the ncl-talk mailing list