<div dir="ltr"><div><div><div><div><div><div><div>Not sure what version of NCL you are using. <br><br></div>(1) calculate_monthly_values was (silently) distributed with NCL prior to 6.2.0<br></div>(2) It was not supported meaning ... questions to ncl-talk would not be <br> answered by NCL developers <br></div>(3) In 6.2.0, a few people talked me into making it public. <br></div> I inadvertently left in an exit statement which I wanted if there was only one value.<br><br></div>You can download a current version via<br><br><a href="http://www.cgd.ucar.edu/~shea/contributed.ncl">http://www.cgd.ucar.edu/~shea/contributed.ncl</a><br><br><br>=======<br>load "./contributed.ncl"<br><br> f = addfile("<a href="http://nhsce_v01r01_19661004_20140901.nc">nhsce_v01r01_19661004_20140901.nc</a>","r")<br><br><br> latStrt = 53<br> latLast = 71<br> lonStrt = 38<br> lonLast = 59<br> <br> ; binary: 0=no snow: 1=snow present<br> sce_we = f->snow_cover_extent(:,latStrt:latLast,lonStrt:lonLast)<br> printVarSummary(sce_we)<br><br> date = cd_calendar(sce_we&time, -2)<br> print(date(0:25))<br> ; grid cell area<br> area_we = f->area(latStrt:latLast,lonStrt:lonLast)<br> printVarSummary(area_we)<br><br> sca_we = sce_we*conform(sce_we, area_we, (/1,2/) )<br> sca_we@long_name = "snow cover area"<br> sca_we@units = area_we@units<br> copy_VarCoords(sce_we, sca_we)<br> printVarSummary(sca_we)<br><br> sca_we_month = calculate_monthly_values(sca_we, "avg", 0, False)<br> printVarSummary(sca_we_month)<br><br></div>; for plotting only<br><br> ; western Europe<br> lat2d_we= f->latitude(latStrt:latLast,lonStrt:lonLast)<br> lon2d_we= f->longitude(latStrt:latLast,lonStrt:lonLast)<br><br> sca_we_month@lat2d = lat2d_we<br></div> sca_we_month@lon2d = lon2d_we<br><div><div><br>=============<br><br><br><br>ariable: sca_we_month<br>Type: float<br>Total Size: 963072 bytes<br> 240768 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 576] x [rows | 19] x [cols | 22]<br>Coordinates: <br> time: [7..17500]<br>Number Of Attributes: 5<br> _FillValue : -9<br> time : 7<br> long_name : snow cover area<br> units : km^2<br> operation_tag : calculate_monthly_values: avg<br><br><div><div><div><br><div><div>====<br></div><div>Respond only to ncl-talk. Please no direct personal salutation<br><br></div><div>Good Luck<br></div><div><br></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 8, 2014 at 6:48 PM, Ipshita Majhi <span dir="ltr"><<a href="mailto:ipmajhi@alaska.edu" target="_blank">ipmajhi@alaska.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Dear NCL,<br><br>I am writing a code to convert weekly data to monthly values and then convert it to calculate say JJA mean.<br><br></div>There are two errors that I encounter:-<br></div>1)calculate_monthly_values: there should be more than one element<br></div>2)This is unsupported code<br><br>;**********************************************************************************<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>;**********************************************************************************<br><br><br>;Reading in the data<br>a =addfile("~/Documents/Snow_cover_IMS/NCL_codes/sce_area_B.nc","r")<br>b=addfile("~/Documents/Snow_cover_IMS/<a href="http://nhsce_v01r01_19661004_20140602.nc" target="_blank">nhsce_v01r01_19661004_20140602.nc</a>","r")<br><br>sce=byte2flt(a->B)<br>lat=b->latitude<br>lon=b->longitude<br><br><br>sce@lat2d=lat<br>sce@lon2d=lon<br><br>;Now adding area with it<br><br>sce_we=sce(:,53:71,38:59);Specific indices for western Europe<br>xMonthAvg = calculate_monthly_values(sce_we, "avg", 0, False)<br>xJJA = month_to_season (xMonthAvg, "JJA")<br>print(xJJA)<br>;**************************************************************<br><br></div>I will be grateful is someone could shed some light on this.<br><br></div>Best Regards<span class="HOEnZb"><font color="#888888"><br>Ipshita<br><div><div><div><div><br></div></div></div></div></font></span></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>