[ncl-talk] Vorticity Advection with NCL

Ehsan Taghizadeh ehsantaghizadeh at yahoo.com
Thu May 24 11:31:14 MDT 2018


 Dear Dennis,The topic "Vorticity Advection with NCL" was not from me. It was from "Lara Quitián Hernández", "laraquitianhernandez at gmail.com".I've just commented about "ftp connection time out", and it seem there is something wrong about my server which I've tried to connect ftp via it. However when I switched another server it seems work.I hope I've been able to say my point correctly.
SincerelyEhsan    On Thursday, May 24, 2018, 9:24:04 PM GMT+4:30, Dennis Shea <shea at ucar.edu> wrote:  
 
 Hi Ehsan,

The shapefile did not can transferred correctly. Please ftp again.

rw-r--r--  1 ftp  ftp            5 May 23 08:17 ShastaGooseDissolve.cpg

On Thu, May 24, 2018 at 7:39 AM, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:

 Dears,
I've just tested from another server, and ftp seems work correctly! I don't know the reason, because I had did ftp from first server before. However I could ftp from second server and couldn't from first server!
SincerelyEhsan
    On Thursday, May 24, 2018, 6:02:04 PM GMT+4:30, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:  
 
  Dears,About Lara's problem with ftp connection, I should say same problem for me, since some days ago, till now. I've asked help from ncl-owner.I'll be thankful if I could have any suggestion.
SincerelyEhsan
    On Thursday, May 24, 2018, 3:46:49 PM GMT+4:30, Lara Quitián Hernández <laraquitianhernandez at gmail. com> wrote:  
 
 Hello, 
I have test the script with your recommendations and I obtain the following errors:
I copy below some useful parts of my script to understand the errors:-----------------
;============================= ============================== =====================; Part A: WRF (curvilinear) to Rectilinear regrid variable and generate  weights ;============================= ============================== =====================

...
;---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
...
;---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)      
;---Options for regridding rectilinear to WRF (curvilinear) grid    Opt                 = True
...
;============================= ============================== ===========;Use 'advect_variable' on the rectilinear grid;============================= ============================== ===========
   adv_vrt = advect_variable(u_reclin, v_reclin, wr_reclin, 0, "vorticity advection", "(m/s)(s-1)",0)
...
;   The grid descriptions have been generated in 'Part A';   but we still need to provide their names.    Opt at SkipSrcGrid     = True    Opt at SkipDstGrid     = True    Opt at DstFileName     = "WRF.SCRIP_grid_description."+ nlat+"_x_"+nlon+".nc"         ; Name of source and    Opt at SrcFileName     = "Rectilinear.SCRIP_grid_ description.nc" ; destination files;    Opt at SrcFileName     = "WRF.SCRIP_grid_description."+ nlat+"_x_"+nlon+".nc" ; destination files    Opt at ForceOverwrite  = True
    Opt at SrcTitle        = Opt at SrcFileName                  ; source grid    Opt at SrcMask2D       = where(ismissing(u_reclin),0,1)    Opt at SrcRegional     = True
    Opt at DstGridType     = "curvilinear"    Opt at DstTitle        = "Rectilinear_to_WRF"    Opt at DstRegional     = True
    Opt at InterpMethod    = InterpMethod    Opt at WgtFileName     = "Rect_to_WRF.WgtFile_"+ InterpMethod+"."+nlat+"_x_"+ nlon+".nc"
    adv_wrf              = ESMF_regrid_with_weights(adv_ vrt, Opt at WgtFileName, False)       ;;; If I use "ESMF_regrid(adv_vrt, Opt at WgtFileName)" as you recommended in your last mail, I obtain this error --> fatal:Argument type mismatch on argument (1) of (ESMF_regrid) can not coerce.    adv_wrf at long_name    = "Advection Vorticity: WRF Grid"    printVarSummary(adv_wrf)    print("adv_wrf: min="+min(adv_wrf)+"   max="+max(adv_wrf))
----------------
Using the blue function I obtain this error --> fatal:Number of subscripts do not match number of dimensions of variable,(3) Subscripts used, (1) Subscripts expected. 
Which refers to this line:
  symMinMaxPlt (adv_wrf(level,:,:),20,False, res)





PS, I have been asking my University Programmer (Complutense University of Madrid or UCM) and he told me that there may be a kind of UCAR "filter" that makes it impossible for us to access the ftp.cgd.ucar.edu servers from the UCM. 
On the other hand, he thinks there may be an interrupted connection on your servers. I do not know how to proceed and send you a WRF file and my script.
Regards, Lara
2018-05-24 10:26 GMT+02:00 Lara Quitián Hernández <laraquitianhernandez at gmail. com>:

Thank you. I am trying to connect via ftp since yesterday but I get a "Connection timed out" message all the time. I'll keep trying.
Regards, Lara
2018-05-24 5:03 GMT+02:00 Dennis Shea <shea at ucar.edu>:


[0] 
You can advect any quantity. I thought it is best to advect relative vorticity and then add the coriolis force to get the 'new' absolute vorticity. However, you could advect absolute vorticity for you needs. Good question for your advisor.  :-)

[1]
You are starting with a WRF grid. The 'advect_variable' function requires a rectilinear grid. Hence, you need to generate a weight file that takes data on a WRF grid to a rectilinear grid. Any name can be used for the weight file. This is fine:  
     "WRF_to_Rect.WgtFile_"+InterpM ethod+"."+nlat+"_x_"+nlon+". nc"

[2]
Now you want to take the advected vorticity on a rectilinear grid and interpolate it to the original WRF grid. The following name is fine.

    Opt at WgtFileName     = "Rect_to_WRF.WgtFile_"+InterpM ethod+"."+nlat+"_x_"+nlon+". nc"

---
You wrote: "I'm still obtaining errors." However, you did not state what the errors are.
 I think the following  

    adv_wrf                          =  ESMF_regrid(adv_vrt, Opt)

should be

    adv_wrf                          =  ESMF_regrid(adv_vrt, Opt at WgtFileName)

---
You did not "ftp a WRF file"

Good Luck


On Wed, May 23, 2018 at 4:30 AM, Lara Quitián Hernández <laraquitianhernandez at gmail.co m> wrote:

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/Docum ent/glossary.shtml#Rectilinear Grid 

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.co m> 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_"+InterpM ethod+"."+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_descri ption."+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 @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_reclinType: floatTotal Size: 5972400 bytes            1493100 valuesNumber of Dimensions: 3Dimensions and sizes: [bottom_top | 35] x [lat | 180] x [lon | 237]Coordinates:             lat: [25.832275390625..40.830703735 35156]            lon: [-34.179443359375..-9.30551147 4609375]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_reclinType: floatTotal Size: 5972400 bytes            1493100 valuesNumber of Dimensions: 3Dimensions and sizes: [bottom_top | 35] x [lat | 180] x [lon | 237]Coordinates:             lat: [25.832275390625..40.830703735 35156]            lon: [-34.179443359375..-9.30551147 4609375]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_reclinType: floatTotal Size: 5972400 bytes            1493100 valuesNumber of Dimensions: 3Dimensions and sizes: [35] x [lat | 180] x [lon | 237]Coordinates:             lat: [25.832275390625..40.830703735 35156]            lon: [-34.179443359375..-9.30551147 4609375]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_vrtType: floatTotal Size: 5972400 bytes            1493100 valuesNumber of Dimensions: 3Dimensions 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_descri ption.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_descrip tion.180_x_237.nc
WRF.SCRIP_grid_description.180 _x_237.nc
WRF_to_Rect.WgtFile_bilinear.1 80_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.co m>:

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.co m> 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 function2.- 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/Appli cations/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.co m> 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.uca r.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/Docum ent/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.co m> 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, 128040 Madrid. Spain
Email: lquitian at ucm.es


______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailma n/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, 128040 Madrid. Spain
Email: lquitian at ucm.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, 128040 Madrid. Spain
Email: lquitian at ucm.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, 128040 Madrid. Spain
Email: lquitian at ucm.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, 128040 Madrid. Spain
Email: lquitian at ucm.es


______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailma n/listinfo/ncl-talk





-- 
Adam Phillips 
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphill i/   303-497-1726 




-- 


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, 128040 Madrid. Spain
Email: lquitian at ucm.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, 128040 Madrid. Spain
Email: lquitian at ucm.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, 128040 Madrid. Spain
Email: lquitian at ucm.es

______________________________ _________________
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/20180524/cf7eb417/attachment-0001.html>


More information about the ncl-talk mailing list