What is NCL ?

The NCAR Command Language (NCL) is a free interpreted language designed specifically for scientific data processing and visualization. NCL has robust file input and output, and can read in particular netcdf files. It can be used to display the Meso-NH output data, and it is an alternate to Diaprog. For more information on NCL, go to http://www.ncl.ucar.edu/overview.shtml. You can also find many examples here: http://www.ncl.ucar.edu/Applications/.

You can also find interesting information on the web pages created for the students of the NCL workshops held in Toulouse at CERFACS in October 2012: http://www.ncl.ucar.edu/Training/Workshops/CERFACS/.

On this page, you will find help on generating NCL scripts for Meso-NH.

Do I have NCL ?

type: which ncl

If it returns no ncl, either you don't have ncl on your machine, or the path variable is not set correctly. Make also sure that the variable NCARG_ROOT is set correctly.

If you get this error message while running ncl, it is because you are missing the file .hluresfile . This file must be saved in your home directory.

Examples (with extractdia)

cd  $SRC_MESONH/src
. ../conf/profile_mesonh
make ncl1_examples

Examples (with lfi2cdf)

cd  $SRC_MESONH/src
. ../conf/profile_mesonh
make ncl2_examples

High resolution coastline dataset

Get and run the following script in the directory where you want to put the dataset: get_ncl_highres_files

MESONHtools and a few example ncl scripts

MESONHtools.ncl

NCL example scripts (if using extractdia): mnh_BasicMap1.ncl mnh_Cloud1.ncl mnh_CrossSection1.ncl mnh_ModelLevels1.ncl mnh_PressureLevel1.ncl

Example of directive for extractdia: dir_exnetcdf

NCL example scripts (if using lfi2cdf): mnh_BasicMap2.ncl mnh_Cloud2.ncl mnh_CrossSection2.ncl mnh_ModelLevels2.ncl mnh_PressureLevel2.ncl

Shapefile to plot department lines over France

Get the file depts_shape.tar and the script plot_departements.ncl . Put both files in the same directory and untar the depts_shape.tar file (it contains 4 files). Edit the file plot_departements.ncl and modify the path of the variable dirname to match the directory where you untar the file depts_shape.tar .

In your ncl script, add this line before the begin command :

load "plot_departements.ncl"

Make sure that the ressources gsnFrame and gsnDraw are set to False. Add these 2 lines after the plot :

lines = new(495,graphic)
lines = draw_depts(wks,plot,lines)

Don't forget to finalize the plot with :

draw(plot)
frame(wks)

Here is an example for the KTEST 16janvier : mnh_BasicMap2_Depts.ncl

NCL scripts for MNH-V4-9-1-0-NETCDF-branch

Here are some examples of scripts to be used with netcdf files generated by the MNH-V4-9-1-0-NETCDF-branch version of Meso-NH : ncl_for_netcdf_branch.tar

How to set projection parameters in NCL for Meso-NH ?

If RPK = 0 : use Mercator projection

For the Mercator projection you should specified these resources as follows:

res@mpProjection           = "Mercator"
res@mpLimitMode            = "Corners"
res@mpLeftCornerLatF       = lat(0,0)
res@mpLeftCornerLonF       = lon(0,0)
res@mpRightCornerLatF      = lat(imax-1,jmax-1)
res@mpRightCornerLonF      = lon(imax-1,jmax-1)
And you should associate latitude and longitude to the variable you want to plot, for example for ZS:
ZS@lat2d = lat
ZS@lon2d = lon

If RPK = 1 or -1 : use Stereographic projection

For the Stereographic projection you should specified these resources as follows:

res@mpProjection           = "Stereographic"
res@mpCenterLonF           = LON0
res@mpCenterRotF           = BETA
res@mpCenterLatF           = 90 ; if rpk=1
or
res@mpCenterLatF           = -90 ; if rpk=-1
res@mpLimitMode            = "Corners"
res@mpLeftCornerLatF       = lat(0,0)
res@mpLeftCornerLonF       = lon(0,0)
res@mpRightCornerLatF      = lat(imax-1,jmax-1)
res@mpRightCornerLonF      = lon(imax-1,jmax-1)
And you should associate latitude and longitude to the variable you want to plot, for example for ZS:
ZS@lat2d = lat
ZS@lon2d = lon
(with lat and lon read from the netcdf file or calculated with MESONHtools)

If -1<RPK<0 or 0<RKP<1: use Lambert projection

For the Lambert projection you should specified these resources as follows:

res@mpProjection          = "LambertConformal"
res@mpLambertParallel1F   = to be ajusted ..
res@mpLambertParallel2F   = res@mpLambertParallel1F
res@mpLambertMeridianF    = LON0
res@mpLimitMode           = "Corners"
res@mpLeftCornerLatF      = lat(0,0)
res@mpLeftCornerLonF      = lon(0,0)
res@mpRightCornerLatF     = lat(imax-1,jmax-1)
res@mpRightCornerLonF     = lon(imax-1,jmax-1)
And you should associate latitude and longitude to the variable you want to plot, for example for ZS:
ZS@lat2d = lat
ZS@lon2d = lon
(with lat and lon read from the netcdf file or calculated with MESONHtools)

Projection and wind : Be Carefull !!

The U and V winds in MesoNH are not zonal and meridian winds. If you want to plot the wind vector in a projection which is different from the projection of your data, you need first to convert wind into their zonal and meridian components. To do so for level k :

d2r = 3.14159/180.
ang = K*((lon0-lon(:,:))*d2r)+B
UZON(k,:,:) = UM(k,:,:)*cos(ang)-VM(k,:,:)*sin(ang)
VMED(k,:,:) = UM(k,:,:)*sin(ang)+VM(k,:,:)*cos(ang)

where : K = XRPK conicity parameter of the projection

B = XBETA is the angle of rotation

lon0 = XLON0 longitude of reference for the projection

lon = longitude

Mesonh-49: UseNCL (last edited 2013-06-07 15:35:32 by JeanPierreChaboureau)