Hi,
I am trying to calculate cumulative sum of a variable and then plot it
but for some reason plot is not generating and I am no error message
as well. I am attaching my script for your convenience. I look forward
to hearing from you.
Thansk
Kamal
===========================================================
;This Script is written to calculate the cumulative sumof DAYMET
precipitation
; First the dimension is reordered of the DAYMET varivale
; Then "dim_cumsum_Wrap" function is applied to calculate cumulative
precipitation
; Then the result of dim_cumsum_Wrap is reordered to (time,lat,lon).
; Plot the cumulative prepicitation
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
begin
;--Data file containing source grid
src_file = "prcp.2010_12296.regrid.nc" ;;---Change (likely)
sfile = addfile(src_file,"r")
src_lat = sfile->lat ;;---Change (likely)
src_lon = sfile->lon ;;---Change (likely)
;---Get variable to regrid
varname = "prcp" ;;---Change (likely)
var = sfile->$varname$ ; Assumption is that "var"
; contains coordinate arrays.
printVarSummary(var)
;*******************************************************************
var@_FillValue = -9999
var_reorder = var(lat|:,lon|:,time|:)
printVarSummary(var_reorder)
var_reorder@_FillValue = -9999
var_cumsum = dim_cumsum_Wrap(var_reorder(:,:,:30),0)
printVarSummary(var_cumsum)
var_cumsum_reorder = var_cumsum(time|:,lat|:,lon|:)
printVarSummary(var_cumsum_reorder)
var_new = var_cumsum_reorder
;----------------------------------------------------------------------
; Plotting section
;----------------------------------------------------------------------
wks = gsn_open_wks("png","Cuml_Sum_DAY_precipitation")
gsn_define_colormap(wks,"BlAqGrYeOrReVi200")
res = True
res@gsnMaximize = True
res@gsnDraw = False
res@gsnFrame = False
res@cnFillOn = True
res@cnLinesOn = False
res@cnLineLabelsOn = False
; res@cnFillMode = "RasterFill"
res@lbLabelBarOn = False ; Turn on later in panel
res@mpFillOn = True
res@gsnLeftString = var@long_name
res@gsnAddCyclic = False
; res@mpMinLatF = min(src_lat)
; res@mpMaxLatF = max(src_lat)
; res@mpMinLonF = min(src_lon)
; res@mpMaxLonF = max(src_lon)
res@pmTickMarkDisplayMode= "Always" ; turn on tickmarks
res@mpOutlineBoundarySets= "GeophysicalAndUSStates" ; state boundaries
res@mpDataBaseVersion = "MediumRes"
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = 10.0
res@cnMaxLevelValF = 150.0
res@cnLevelSpacingF = 10.0
;*************************************************************************************
var_new@lat2d = src_lat
var_new@lon2d = src_lon
;---Resources for plotting original data
; res@gsnAddCyclic = False
res@tiMainString = "Original rectilinear grid"
plot = gsn_csm_contour_map(wks,var_new(30,:,:),res)
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Feb 22 15:05:55 2013
This archive was generated by hypermail 2.1.8 : Fri Feb 22 2013 - 17:42:16 MST