[ncl-talk] How to save time as a dimension when multiplying two matices

Ipshita Majhi ipmajhi at alaska.edu
Fri Sep 12 13:01:57 MDT 2014


Hi,
I am trying to create a new matrix where snow cover extent (sce) which are
in bytes is multiplied by area to get the real km2 values. In the process I
am loosing the time information. How to save that so that I can create
monthly avg.
Best Regards
Ipshita


; This program is to calculate the area average for snow for all the data
period
;*******************************************
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"
;*******************************************

;To create a new matrix with area values multiplied to the binary values so
that we can get

a=addfile("~/Documents/Snow_cover_IMS/nhsce_v01r01_19661004_20140602.nc
","r")
sce=a->snow_cover_extent

;print(dimsizes(sce))

sce_area=a->area

B = new((/2487,88,88/),float)

       do i = 0,2486
         B(i,:,:)=sce(i,:,:)*sce_area(:,:)
       end do

xMonthAvg = calculate_monthly_values(B, "avg", 0, False)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140912/0a35884b/attachment.html 


More information about the ncl-talk mailing list