Load "$ ncarg_root/lib/ncarg/nclscripts/CSM/gsn_code.ncl" begin cdf_file = AddFile ("$ ncarg_root/lib/ncarg/data/CDF/contour. CDF "," R ") temp = cdf_file-> T (0, 0,:,:); variable temperature z = cdf_file-> Z (0, 0 ,:,:); variable geopotential height pres = cdf_file-> PSL (0,:,:); variable pressure at mean sea level lat = cdf_file-> Lat; variable latitude Lon = cdf_file-> Lon; variable long1_temp = temp-273.15; temperature conversion Kelvin-> Celsius pres = Pres * 0.01; pressure conversion pa-> MB [email protected] = "(c)"; change unit [email protected] = "(MB )"; change the unit xwks = gsn_open_wks ("X11", "gsun02n"); open the workspace of X11. plot = gsn_contour (xwks, temp, false); draw an isoplot; ------------- begin second plot ------------------------------------- resources = true; set the resource to [email protected] = false; disable the scheme of drawing a color [email protected] = "temperature (c)"; Title plot = gsn_contour (xwks, te MP, resources); draw the isoplot; ------------- Begin third plot ------------------------------------- [email protected] = true; open the isoplot to fill in [email protected] = false; disable single line filling of the isoplot [email protected] = true [email protected] = true [email protected] = [email protected] _ name [email protected] = [email protected] _ name [email protected] = Lon [email protected] = lat plot = gsn_contour (xwks, temp, resources); draw the contour Figure; ---------- begin fourth plot ------------------------------------------ [email protected] = true; fill [email protected] = false with solid; use complex colors [email protected] = false; line Label [email protected] = false; Information Label [email protected] = false; contour [email protected] = "always"; toolbar [email protected] = false; disable perimeter [email protected] = [email protected] _ name [email protected] = 26 [email protected] = 26 [Email protected] = 26 plot = gsn_contour (xwks, Z, resources); draw the isoplot; ---------- begin th plot ---------------------------------------------- cmap = ., 0 ., 0. /), (/1 ., 1 ., 1. /),(/. 1 ,. 1 ,. 1 /),(/. 15 ,. 15 ,. 15 /),(/. 2 ,. 2 ,. 2 /),(/. 25 ,. 25 ,. 25 /),(/. 3 ,. 3 ,. 3 /),(/. 35 ,. 35 ,. 35 /),(/. 4 ,. 4 ,. 4 /),(/. 45 ,. 45 ,. 45 /),(/. 5 ,. 5 ,. 5 /),(/. 55 ,. 55 ,. 55 /),(/. 6 ,. 6 ,. 6 /),(/. 65 ,. 65 ,. 65 /),(/. 7 ,. 7 ,. 7 /),(/. 75 ,. 75 ,. 75 /),(/. 8 ,. 8 ,. 8 /),(/. 8 5 ,. 85 ,. 85/) gsn_define_colormap (xwks, cmap); define a new color map [email protected] = [email protected] _ name plot = gsn_contour (xwks, Pres, resources ); plot an isoplot print (temp (,); output the temp variable print (temp! 0); print (temp! 1); outputs the temp two-dimensional name print ([email protected] _ name); the output attributes long_name and units print ([email protected]) print (temp & LAT ); output variable lat print (temp & Lon); output variable Lon ascii_file = "data. ASC "; create an asc11 file name system ("/bin/Rm-F "+ ascii_file); remove the asc11 file asciiwrite (ascii_file, temp (,); write to asc11
Delete (PLOT); clear Delete (temp) Delete (resources) End
Example 2-contour plots