load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin ; Read file. file_name = "2A25.20090515.65505.7.HDF" hdf4_file=addfile(file_name, "r") ; Print metadata information. print(hdf4_file) ; Read lat/lon data. longitude=hdf4_file->Longitude latitude=hdf4_file->Latitude ; Correct units to follow the CF conventions. ; In the HDF4 file, the attribute values are "degrees". longitude@units = "degrees_east" latitude@units = "degrees_north" ; Read data for plot. RF = hdf4_file->rain RF@lon2d = longitude RF@lat2d = latitude ;RF@_FillValue = -8888 printVarSummary(RF) printMinMax(RF,True) ; asciiwrite("RF.txt",RF) Rf = short2flt(RF) Rf@_FillValue = -999900 printVarSummary(Rf) printMinMax(Rf,True) Rf_fnl = where(Rf.eq.-888800,Rf@_FillValue,Rf) printVarSummary(Rf_fnl) printMinMax(Rf_fnl,True) printMinMax(Rf_fnl(:,:,0),True) printMinMax(Rf_fnl(:,:,1),True) printMinMax(Rf_fnl(:,:,2),True) printMinMax(Rf_fnl(:,:,3),True) printMinMax(Rf_fnl(:,:,4),True) printMinMax(Rf_fnl(:,:,5),True) printMinMax(Rf_fnl(:,:,6),True) Rf_fnl@lon2d = longitude Rf_fnl@lat2d = latitude ; asciiwrite("Rf.txt",Rf) XWKS = gsn_open_wks("png","test1") gsn_define_colormap(XWKS,"default") res = True ; plot mods desired res@cnFillOn = True ; enable contour fill res@cnLevelSelectionMode = "AutomaticLevels" ; res@cnLevels = (/0,20,30,40,50,60,70,80,90,1000/) res@mpMinLatF = 0.0 res@mpMaxLatF = 25.0 res@mpMinLonF = 60.0 res@mpMaxLonF = 100.0 res@tiMainString = file_name plot = gsn_csm_contour_map_ce(XWKS,Rf_fnl(:,:,0),res) end