[gradsusr] Masked data output to text file
Justin Hicks
jhicks2014 at gmail.com
Thu Jun 30 09:55:47 EDT 2016
Jeff,
I'm using the following code to extract the date:
'q dims'
rectime = sublin(result,5)
recdate = subwrd(rectime,6)
recmonth = substr(recdate,6,3)
say 'Date: 'recdate
say 'Month: 'recmonth
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.
-Justin
On Wed, Jun 29, 2016 at 2:56 PM, Jeff Duda <jeffduda319 at gmail.com> wrote:
> Justin,
> 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.
>
> Jeff Duda
>
> On Wed, Jun 29, 2016 at 1:48 PM, Justin Hicks <jhicks2014 at gmail.com>
> wrote:
>
>> GrADS users,
>>
>> 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.
>>
>> 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:
>>
>> 'reinit'
>> 'open Region00_WLD_mask_TEST.nc'
>> 'set t 13 last'
>> 'set dfile 1'
>> 'set lon -179.5 179.5'
>> 'set lat -89.5 89.5'
>> 'open /data2/control/MERRA2_PRECIP
>> 'set dfile 2'
>> 'set lon -179.5 179.5'
>> 'set lat -89.5 89.5'
>> 'set time 00Z01JAN1980 00Z01APR2016'
>> 'set dfile 1'
>> 'd
>> aave(maskout(VAR.2,mask.1(time=00Z01JAN1980)),lon=-179.5,lon=179.5,lat=-89.5,lat=89.5)'
>> 'set gxout print'
>> 'set prnopts %6.2f 1 1'
>> write('MERRA2_MASK_DATA.txt', 'WLD Mon/Yr Precip Max Min')
>>
>>
>> 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.
>>
>> -Justin
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
>
> --
> Jeff Duda
> Post-doctoral research associate
> University of Oklahoma School of Meteorology
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20160630/a107a113/attachment.html
More information about the gradsusr
mailing list