[ncl-talk] Month to season and weekly to month errors

Dennis Shea shea at ucar.edu
Thu Oct 9 11:02:48 MDT 2014


Not sure what version of NCL you are using.

(1) calculate_monthly_values was (silently) distributed with NCL prior to
6.2.0
(2) It was not supported meaning ... questions to ncl-talk would not be
      answered by NCL developers
(3) In 6.2.0, a few people talked me into making it public.
     I inadvertently left in an exit statement which I wanted if there was
only one value.

You can download a current version via

http://www.cgd.ucar.edu/~shea/contributed.ncl


=======
load "./contributed.ncl"

 f    = addfile("nhsce_v01r01_19661004_20140901.nc","r")


 latStrt = 53
 latLast = 71
 lonStrt = 38
 lonLast = 59

                                   ; binary: 0=no snow: 1=snow present
 sce_we  = f->snow_cover_extent(:,latStrt:latLast,lonStrt:lonLast)
 printVarSummary(sce_we)

 date    = cd_calendar(sce_we&time, -2)
 print(date(0:25))
                                   ; grid cell area
 area_we = f->area(latStrt:latLast,lonStrt:lonLast)
 printVarSummary(area_we)

 sca_we  = sce_we*conform(sce_we, area_we, (/1,2/) )
 sca_we at long_name = "snow cover area"
 sca_we at units     =  area_we at units
 copy_VarCoords(sce_we, sca_we)
 printVarSummary(sca_we)

 sca_we_month     = calculate_monthly_values(sca_we, "avg", 0, False)
 printVarSummary(sca_we_month)

; for plotting only

                                 ; western Europe
 lat2d_we= f->latitude(latStrt:latLast,lonStrt:lonLast)
 lon2d_we= f->longitude(latStrt:latLast,lonStrt:lonLast)

  sca_we_month at lat2d = lat2d_we
  sca_we_month at lon2d = lon2d_we

=============



ariable: sca_we_month
Type: float
Total Size: 963072 bytes
            240768 values
Number of Dimensions: 3
Dimensions and sizes:    [time | 576] x [rows | 19] x [cols | 22]
Coordinates:
            time: [7..17500]
Number Of Attributes: 5
  _FillValue :    -9
  time :    7
  long_name :    snow cover area
  units :    km^2
  operation_tag :    calculate_monthly_values: avg


====
Respond only to ncl-talk. Please no direct personal salutation

Good Luck


On Wed, Oct 8, 2014 at 6:48 PM, Ipshita Majhi <ipmajhi at alaska.edu> wrote:

> Dear NCL,
>
> I am writing a code to convert weekly data to monthly values and then
> convert it to calculate say JJA mean.
>
> There are two errors that I encounter:-
> 1)calculate_monthly_values: there should be more than one element
> 2)This is unsupported code
>
>
> ;**********************************************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> ;**********************************************************************************
>
>
> ;Reading in the data
> a =addfile("~/Documents/Snow_cover_IMS/NCL_codes/sce_area_B.nc","r")
> b=addfile("~/Documents/Snow_cover_IMS/nhsce_v01r01_19661004_20140602.nc
> ","r")
>
> sce=byte2flt(a->B)
> lat=b->latitude
> lon=b->longitude
>
>
> sce at lat2d=lat
> sce at lon2d=lon
>
> ;Now adding area with it
>
> sce_we=sce(:,53:71,38:59);Specific indices for western Europe
> xMonthAvg = calculate_monthly_values(sce_we, "avg", 0, False)
> xJJA = month_to_season (xMonthAvg, "JJA")
> print(xJJA)
> ;**************************************************************
>
> I will be grateful is someone could shed some light on this.
>
> Best Regards
> Ipshita
>
>
> _______________________________________________
> 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/20141009/e9288eba/attachment.html 


More information about the ncl-talk mailing list