<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
Hi, Stuart —
<div>There is an example for creating a monthly climatology in the documentation for the ‘modify’ command —
<a href="http://cola.gmu.edu/grads/gadoc/gradcomdmodify.html">http://cola.gmu.edu/grads/gadoc/gradcomdmodify.html</a>. Write out the defined climo to disk (using fwrite instead of sdfwrite so there is no time metadata attached to the file) and create a new
data set (an example descriptor is copied below). The script sample is taken from what I use to create the temperature anomaly plots in the climate outlooks at <a href="http://wxmaps.org/pix2/clim.html">http://wxmaps.org/pix2/clim.html</a>. Most of this code
is for figuring out weights (fac1 and fac2) for the monthly climatology values in order to match the time period of the 8-day average from the GFS forecast; that may be more complicated than necessary, you could probably just as easily use the climatology
for the current month. </div>
<div>—Jennifer</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div><font face="Courier" size="2">'open /data/gfs0p25/ctl/latest.gfs'</font></div>
<div><font face="Courier" size="2">'open /data/tclim.ctl' </font></div>
<div><font face="Courier" size="2">setcols()</font></div>
<div><font face="Courier" size="2">chrmon = 'JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC'</font></div>
<div><font face="Courier" size="2">julian = ' 0 31 59 90 120 151 181 212 243 273 304 334'</font></div>
<div><font face="Courier" size="2">julian_mid = ' 15 45 74 105 135 166 196 227 258 288 319 349 380'</font></div>
<div><font face="Courier" size="2"><br>
</font></div>
<div><font face="Courier" size="2">tlast=65</font></div>
<div><font face="Courier" size="2">'set dfile 1'</font></div>
<div><font face="Courier" size="2">'set t 'tlast</font></div>
<div><font face="Courier" size="2">'q time'</font></div>
<div><font face="Courier" size="2">txtdat = subwrd(result,3)</font></div>
<div><font face="Courier" size="2">txtday = substr(txtdat,4,2)</font></div>
<div><font face="Courier" size="2">txtmon = substr(txtdat,6,3)</font></div>
<div><font face="Courier" size="2">imon = 1</font></div>
<div><font face="Courier" size="2">while(imon<13)</font></div>
<div><font face="Courier" size="2"> lmon = imon - 1</font></div>
<div><font face="Courier" size="2"> monmon = subwrd(chrmon,imon)</font></div>
<div><font face="Courier" size="2"> if (monmon = txtmon)</font></div>
<div><font face="Courier" size="2"> if (imon > 1)</font></div>
<div><font face="Courier" size="2"> res = subwrd(julian,imon)</font></div>
<div><font face="Courier" size="2"> else</font></div>
<div><font face="Courier" size="2"> res = 0</font></div>
<div><font face="Courier" size="2"> endif</font></div>
<div><font face="Courier" size="2"> mrfjul = res + txtday</font></div>
<div><font face="Courier" size="2"> break</font></div>
<div><font face="Courier" size="2"> endif</font></div>
<div><font face="Courier" size="2"> imon = imon + 1</font></div>
<div><font face="Courier" size="2">endwhile</font></div>
<div><font face="Courier" size="2">midjul = subwrd(julian_mid,imon)</font></div>
<div><font face="Courier" size="2">if(mrfjul < midjul)</font></div>
<div><font face="Courier" size="2"> mon1 = imon - 1</font></div>
<div><font face="Courier" size="2"> mon2 = imon</font></div>
<div><font face="Courier" size="2"> if (mon1 = 0)</font></div>
<div><font face="Courier" size="2"> jul1 = -15</font></div>
<div><font face="Courier" size="2"> mon1 = 12</font></div>
<div><font face="Courier" size="2"> else</font></div>
<div><font face="Courier" size="2"> res = subwrd(julian_mid,mon1)</font></div>
<div><font face="Courier" size="2"> jul1 = res</font></div>
<div><font face="Courier" size="2"> endif</font></div>
<div><font face="Courier" size="2"> jul2 = midjul</font></div>
<div><font face="Courier" size="2"> fac1 = (jul2-mrfjul)/(jul2-jul1)</font></div>
<div><font face="Courier" size="2"> fac2 = (mrfjul-jul1)/(jul2-jul1)</font></div>
<div><font face="Courier" size="2">else</font></div>
<div><font face="Courier" size="2"> mon1 = imon</font></div>
<div><font face="Courier" size="2"> mon2 = imon + 1</font></div>
<div><font face="Courier" size="2"> res = subwrd(julian_mid,mon2)</font></div>
<div><font face="Courier" size="2"> jul2 = res</font></div>
<div><font face="Courier" size="2"> jul1 = midjul</font></div>
<div><font face="Courier" size="2"> fac1 = (jul2-mrfjul)/(jul2-jul1)</font></div>
<div><font face="Courier" size="2"> fac2 = (mrfjul-jul1)/(jul2-jul1)</font></div>
<div><font face="Courier" size="2"> if (mon2 = 13)</font></div>
<div><font face="Courier" size="2"> mon2 = 1</font></div>
<div><font face="Courier" size="2"> endif</font></div>
<div><font face="Courier" size="2">endif</font></div>
<div><font face="Courier" size="2">time1 = mon1</font></div>
<div><font face="Courier" size="2">time2 = mon2</font></div>
<div><font face="Courier" size="2"><br>
</font></div>
<div><font face="Courier" size="2">* Define mean temperature </font></div>
<div><font face="Courier" size="2">'set dfile 1'</font></div>
<div><font face="Courier" size="2">'set t 1'</font></div>
<div><font face="Courier" size="2">'tfcst = ave(t2m.1-273.16,t=2,t='tlast')'</font></div>
</div>
<div>
<div><font face="Courier" size="2"><br>
</font></div>
<div><font face="Courier" size="2">* Define the climatological temperature for this period</font></div>
<div><font face="Courier" size="2">'set dfile 2'</font></div>
<div><font face="Courier" size="2">'set t 1'</font></div>
<div><font face="Courier" size="2">'tclim = t(t='time1')*'fac1'+t(t='time2')*'fac2</font></div>
<div><font face="Courier" size="2"><br>
</font></div>
<div><font face="Courier" size="2">* Draw the anomaly</font></div>
<div><font face="Courier" size="2">'d tfcst-lterp(tclim,tfcst)'</font></div>
</div>
<div><br>
</div>
<div>
<div>p.s. The contents of the descriptor file (tclim.ctl) look like this:</div>
<div><br>
</div>
<div>
<div><font face="Courier" size="2">DSET ^tclim.dat</font></div>
<div><font face="Courier" size="2">UNDEF -9.99e+33 </font></div>
<div><font face="Courier" size="2">TITLE CRU mean surface temperature climatology 1901-2000 Regridded</font></div>
<div><font face="Courier" size="2">XDEF 360 linear 0 1</font></div>
<div><font face="Courier" size="2">YDEF 181 linear -90 1</font></div>
<div><font face="Courier" size="2">ZDEF 1 LEVELS 1 </font></div>
<div><font face="Courier" size="2">TDEF 12 LINEAR JAN1979 1mo</font></div>
<div><font face="Courier" size="2">VARS 1</font></div>
<div><font face="Courier" size="2">t 0 0 mean temperature [C]</font></div>
<div><font face="Courier" size="2">ENDVARS</font></div>
</div>
<div><font face="Courier" size="2"><br>
</font></div>
<div>
<div>On Apr 14, 2016, at 5:50 AM, Chorley Weather <<a href="mailto:weatherstu@chorleyweather.com">weatherstu@chorleyweather.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div style="font-size: 10pt; font-family: Tahoma,Arial,Helvetica,sans-serif">
<p>Hi all, </p>
<p>I've wanted to create anomaly charts for some time now using data from the GFS along side climatology data, say from 1981-2010, perhaps using CFSR. However I'm unsure where to start with this really, is there anybody who could throw some advice or perhaps
an old script that I could teach myself. Any help would be greatly appreciated. </p>
<p>Best regards,</p>
<div>-- </div>
<div>
<p>Stuart Markham</p>
<p><img src="http://www.chorleyweather.com/forecast-charts/SampleDatasets/logo%20450x100.PNG" alt=""></p>
</div>
</div>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
http://gradsusr.org/mailman/listinfo/gradsusr<br>
</blockquote>
</div>
<br>
<div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="font-size: 12px; orphans: 2; widows: 2;">--</div>
<div style="font-size: 12px; orphans: 2; widows: 2;">Jennifer Miletta Adams<br>
Center for Ocean-Land-Atmosphere Studies (COLA)<br>
George Mason University<br>
<br>
<br>
</div>
</div>
</div>
</div>
<br>
</div>
</body>
</html>