For more information about the workshops themselves, including sample scripts using during the class, visit: http://www.ncl.ucar.edu/Training/Workshops/CERFACS/.
Example pages containing:
tips |
resources |
functions/procedures
For more information about the workshops themselves, including sample scripts using during the class, visit: http://www.ncl.ucar.edu/Training/Workshops/CERFACS/.
The lambert conformal projection information was written to the file via the "Lambert_Conformal" variable, so we were able to use this to set the special lambert parallel and merdian resources.
It plots the near-surface air temperature ("tas") from an ALADIN file, putting it on a lambert conformal projection.
To create an animated GIF of this variable which has 384 time steps, run ALADIN_tas_anim.ncl. The cd_calendar function is used to create a time stamp as the main title.
To create the GIF file, you must have the free convert tool from ImageMagick installed. A file called ALADIN_tas_anim.gif will be created, which you can open with your web browser to see the animation. In the script, every 10th timestep is plotted. This was to keep the GIF file small. To plot every time step, simply remove the ",10" from the do loop.
It was created by Pierre Nabat during the NCL Workshop at CERFACS, October 4-5, 2012.
The datasets were provided bymodel on a lambert conformal map. The data were provided by Pierre Nabat of Météo-France.
You can modify this script to change which variables you want to plot by changing the "varc" line.
Contours of the original data and the masked data are "paneled" on the same page using gsn_panel.
If you are using NCL V6.0.0 or earlier, then you need to download this gsn_coordinates.ncl script.
To create an animated GIF of this variable across all 120 timesteps, run IPSL_thetao_anim.ncl. You must have the free convert tool from ImageMagick installed to create the GIF file. The cd_calendar function is used to create a time stamp as the main title.
Optionally, you can set USE_SHAPEFILE to True to draw country outlines from a shapefile instead of using NCL map outlines. To use the shapefile outlines, you must download the "country bounaries" shapefile data from http://www.diva-gis.org/Data/.
The missing values for this variable had to be "fixed" because they were not exactly equal to the sst@_FillValue value. This was done by using the where function to set all values greater-than-or-equal to sst@_FillValue to sst@_FillValue.
The getfilevarnames function is used to read all the variable names off the file. The isnumeric and dimsizes functions are then used to check if this variable is numeric and how many dimensions it has.
Each variable is plotted to its own PNG file.
The "iicethic" variable is of type "short" on the file, with a "scale_factor" that needs to be applied, so short2flt is used to do the conversion.
For faster plotting, it's important to set:
res@cnFillMode = "RasterFill" res@trGridType = "TriangularMesh"
When NCL V6.1.0 is released, you can try an experimental fill mode of "MeshFill" for even faster plotting.
For an example of plotting the full grid, see the "ORCA12_gridUV_vel_3.ncl" script at http://www.ncl.ucar.edu/Training/Workshops/CERFACS/Scripts/ORCA/.
All temperature values equal to 0.0 are set to a missing value so they don't get plotted. This effectively masks out the land values.
If USE_SHAPEFILE is set to True, then you must download the France shapefile data from www.gadm.org/country.
This script uses the "WhiteBlueGreenYellowRed" color table, which has several very light shades of white and blue at the beginning that we may not want. To remove these, you can read in the color table with read_colormap_file, and then subset as necessary when setting the cnFillPalette resource.
After about time index 2991, the time values suddenly go to 0, so we have cull these values out by using ind to get only the time values that are > 0.
You must have the free convert tool from ImageMagick installed to create the GIF file.
Click on the thumbnail to see the animation.