<div dir="ltr">Jeff,<div><br></div><div>I'm using the following code to extract the date:</div><div><br></div><div><div>'q dims'</div><div>rectime = sublin(result,5)</div><div>recdate = subwrd(rectime,6)</div><div>recmonth = substr(recdate,6,3)</div><div>say 'Date: 'recdate</div><div>say 'Month: 'recmonth</div></div><div><br></div><div><br></div><div>However, I believe I need a while loop so that the date will not show up only once, but instead once for each monthly area average. How would I go about writing a while loop for the date when it is in the following format: for example, 00Z01JAN1979 is the starting date. Wouldn't the 'Z' throw it off? Maybe I could set JAN equal to 1 and go from there. I'm teaching myself as I go along, as I haven't had much exposure to while and for loops. </div><div><br></div><div>-Justin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 29, 2016 at 2:56 PM, Jeff Duda <span dir="ltr"><<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@gmail.com</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>Justin,<br></div>Build up a string variable and write the string to your data file. You'll have to pull each value after issuing the display command, then add each piece to the full string variable.<br><br></div>Jeff Duda<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Jun 29, 2016 at 1:48 PM, Justin Hicks <span dir="ltr"><<a href="mailto:jhicks2014@gmail.com" target="_blank">jhicks2014@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">GrADS users,<div><br></div><div>I want to output data to a text file; I have a variety of masks that I am using to get data from specific regions. I am running an area average of monthly data from 1980-2016 using the 'maskout' function. </div><div><br></div><div>I want my data to output into 5 columns: 'Region' 'Month/Year(Date)' 'Precip(Data)' 'Max Value' 'Min Value'. I want these all to be in the same row with their results underneath. So far, I only have part of a script:</div><div><br></div><div><div>'reinit'</div><div>'open Region00_WLD_mask_TEST.nc'</div><div>'set t 13 last'</div><div>'set dfile 1'</div><div>'set lon -179.5 179.5'</div><div>'set lat -89.5 89.5'</div><div>'open /data2/control/MERRA2_PRECIP</div><div>'set dfile 2'</div><div>'set lon -179.5 179.5'</div><div>'set lat -89.5 89.5'</div><div>'set time 00Z01JAN1980 00Z01APR2016'</div><div>'set dfile 1'</div><div>'d aave(maskout(VAR.2,mask.1(time=00Z01JAN1980)),lon=-179.5,lon=179.5,lat=-89.5,lat=89.5)'</div><div>'set gxout print'</div><div>'set prnopts %6.2f 1 1'</div><div>write('MERRA2_MASK_DATA.txt', 'WLD Mon/Yr Precip Max Min')</div></div><div><br></div><div><br></div><div>I assume that there is no way to display the region unless you put it in lat/lon coordinates, but how could I go about outputting the date, the precipitation data, and the max/min data for each month? Also, this text file will be added to with other masked variables, and I know I must use the command 'apprend' somewhere.</div><span><font color="#888888"><div><br></div><div>-Justin</div></font></span></div>
<br></div></div>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div>Jeff Duda<br>Post-doctoral research associate<br>University of Oklahoma School of Meteorology<br></div></div></div>
</font></span></div>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br></div>