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

Dennis Shea shea at ucar.edu
Fri Sep 12 15:53:37 MDT 2014


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 = sce_area

       do i = 0,2486
         B(i,:,:)=(/ sce(i,:,:)*sce_area(:,:) /)
       end do
B at long_name = "sce*sce_area"

xMonthAvg = calculate_monthly_values(B, "avg", 0, False)

On Fri, Sep 12, 2014 at 1:01 PM, Ipshita Majhi <ipmajhi at alaska.edu> wrote:

> 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)
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140912/d943600a/attachment.html 


More information about the ncl-talk mailing list