NCL Scripts

293 views
Skip to first unread message

pkar...@gmail.com

unread,
Aug 20, 2016, 2:17:35 PM8/20/16
to MPAS-Atmosphere Help
Hi,

May I get some NCL scripts for plotting Wind vectors at a particular pressure level? Few other scripts will also be most welcome..
Thanks in advance...

Pradeep Kumar Arora

MPAS-Atmosphere Help

unread,
Aug 22, 2016, 7:02:46 PM8/22/16
to MPAS-Atmosphere Help
Hi, Pradeep.

Some of the NCL example scripts on this page do include code for adding wind vectors to plots: http://mpas-dev.github.io/atmosphere/visualization.html . See, e.g., the "mpas-a_contours.ncl" script: http://www2.mmm.ucar.edu/projects/mpas/visualization/ncl/mpas-a_contours.ncl . To add wind vectors, you'll need to set winds = True at the top of the script.

One major limitation of the above scripts is that the wind vectors are plotted at every cell face, rather than, e.g., on a thinned regular rectangular grid. You could try following something like the code in this snippet to instead plot wind barbs on a sparser, regular grid:

     ugrid = f->u(t,:,25)
     vgrid = f->v(t,:,25)

     esizes = dimsizes(ugrid)
     u = new(esizes,double)
     v = new(esizes,double)
     do i=0,esizes(0)-1
        u(i) = ugrid(i)*cos(alpha(i)) - vgrid(i)*sin(alpha(i))
        v(i) = ugrid(i)*sin(alpha(i)) + vgrid(i)*cos(alpha(i))
     end do

     nbarbsX = 25
     nbarbsY = 15
     barb_lats = new(nbarbsY,float)
     barb_lons = new(nbarbsX,float)

     do i=0,nbarbsX-1
        barb_lons(i) = minLon + (maxLon - minLon) * (i+0.5) / nbarbsX
     end do
     do i=0,nbarbsY-1
        barb_lats(i) = minLat + (maxLat - minLat) * (i+0.5) / nbarbsY
     end do

     rlat = doubletofloat(latEdge)
     rlon = doubletofloat(lonEdge)

     u_interp = cssgrid(rlat, rlon, u, barb_lats, barb_lons)
     v_interp = cssgrid(rlat, rlon, v, barb_lats, barb_lons)

     wmsetp("WBF",0)
     wmsetp("WDF",1)
     wmsetp("WBC",0.0)
     wmsetp("WBS",0.025)

     do i=0,nbarbsY-1
     do j=0,nbarbsX-1
        wmbarbmap(wks, barb_lats(i), barb_lons(j), doubletofloat(u_interp(i,j)), doubletofloat(v_interp(i,j)))
     end do
     end do


For vectors instead of barbs, you could change the "wmbarbmap" function to "wmvectmap".

When it comes to winds on isobaric levels, there are a few options you could try. The most general would be to write your own code to interpolate winds to your desired pressure level from model output files. Alternatively, you could extend the code in src/core_atmosphere/mpas_atm_interp_diagnostics.F to have the model interpolate to your chosen pressure levels, and to write out the uZonalReconstruct and uMeridionalReconstruct fields on these levels. The latter option is nice, because the wind components are already given as zonal and meridional components, so there is no need to rotate the normal (u) and tangential (v) horizontal wind vectors.

Kind regards,
Michael
Reply all
Reply to author
Forward
0 new messages