[gradsusr] Sum daily values for precipitation

gabriel gavinho gavinho.gabriel at gmail.com
Wed Jun 22 15:15:27 EDT 2011


Dear Chuck,

I couldn't run the prec_accum.gs in GrADS, i got this message:

"Open Error:  Can't open binary data file
  File name = ifamean.grt
SET Error:  No files open yet
SET Error:  No files open yet
SET Error:  No files open yet
SET Error:  No files open yet
DEFINE error:  no file open yet
DISPLAY error:  no file open yet
Hardcopy output file is closed
Number of frames = 1"

I'm not sure what to do, I tried unziping the prec_accum.ps.gz but it didn't
work either. I don't really know much about it but is .ctl supposed to be
ifamean.ctlt or ifamean.ctl? it maybe the reason it didn't work,

thanks for your help,
Gabriel Gavinho

2011/6/22 Charles Seman <Charles.Seman at noaa.gov>

> Gabriel,
>
> Please find attached a GrADS script prec_accum.gs in which a technique of
> Vaughan Phillips has been adapted for plotting the observed TOGA accumulated
> precipitation (mm) from the precipitation rate (mm/h) defined at 3-hourly
> intervals for the time period 00Z20DEC1992 to 21Z25DEC1992.  The GrADS ctl
> file ifamean.ctlt and resulting plot file prec_accum.ps.gz are also
> attached.
>
> I hope this helps, and please let me know if you have any questions.
>
> Thanks,
> Chuck
>
> gabriel gavinho wrote:
>
>> Dear Serge,
>>
>> The solution you proposed did solve the problem envolving the plot of both
>> variables, but it displays a straight line with the final result for
>> accumulated precipitation instead of the increasing line presenting the
>> gradual accumulation. Do you know how can I sort this out?
>> still, thank you very much for your help,
>>
>> regards
>>
>> Gabriel Gavinho
>> Federal University of Rio de Janeiro
>>
>> 2011/6/21 Rafanoharana Serge Claudio <rafanoharana at gmail.com <mailto:
>> rafanoharana at gmail.com**>>
>>
>>
>>    Dear Gabriel,
>>
>>    In order to obtain the total precipitation within a month, you can
>>    just 'define acc=sum(pcp, t=1, t=31)'.
>>    If I really understand what you want is that you would like to
>>    display both daily and accumulation within one graphic. If so, it's
>>    a little bit tricky but what I can suggest is that if you want to
>>    display both within one graphic, try to set gxout linefill since
>>    linefill can deal with 2 variables, then go back to set gxout line
>>    so it will be something like:
>>
>>    'sdfopen file.nc <http://file.nc>'
>>
>>    'set lat -23'
>>    'set lon -45'
>>    'set t 1 31'
>>
>>    'define acc=sum(pcp, t=1, t=31)'
>>    'set gxout linefill'
>>    'set lfcols 0 0'    (----> this is black color and you can refer to
>>    http://www.iges.org/grads/**gadoc/colorcontrol.html<http://www.iges.org/grads/gadoc/colorcontrol.html>
>> )
>>    'd pcp;acc'         (up til here, you have only the x and y value,
>>    without the graphs, so you need to plot the graph)
>>    'set gxout line'
>>    'set ccolor 3'
>>    'd pcp'
>>    'set ccolor 5'
>>    'd acc'
>>
>>    Hope this can help,
>>
>>
>>    Regards,
>>
>>    Serge
>>
>>    2011/6/21 gabriel gavinho <gavinho.gabriel at gmail.com
>>    <mailto:gavinho.gabriel at gmail.**com <gavinho.gabriel at gmail.com>>>
>>
>>
>>        Dear Serge,
>>
>>        I belive I did not make myself clear about the graphic I need.
>>        suppose I select a single point, let's say lat -23 lon -45, and
>>        set the time to a month period, I will have the values of
>>        precipitation for each day as it is in any meteogram.
>>        My problem is that I need to continually sum the daily valeus so
>>        I can achive the total precipitation within a month but in a way
>>        I can present an increasing line in over the daily values.
>>        I hope I could make it clear and I really appreciate your help
>>
>>        Regars,
>>        Gabriel Gavinho
>>        Federal University of Rio de Janeiro.
>>
>>
>>        2011/6/21 Rafanoharana Serge Claudio <rafanoharana at gmail.com
>>        <mailto:rafanoharana at gmail.com**>>
>>
>>
>>            Dear Gabriel,
>>
>>            What do you mean by "in the same graphic"? because I think
>>            it will depends on that. For your precipitation data, if you
>>            set your gxout to shaded, I think you won't see both values,
>>            but if you set your gxout, for example to contour, you'll be
>>            able to see both.
>>
>>            Let's say your precipitaion variable is "pcp". It will be
>>            something like:
>>            'sdfopen file.nc <http://file.nc>'
>>
>>            'set gxout contour'
>>            'define acc=sum(pcp, t=1, t=31)'
>>            'd pcp'
>>            'd acc'
>>
>>            So if you need for the day 17, just set t to 17 by adding
>>            'set t 17' right after 'sdfopen...'
>>            In addition, you can write your accumulation variable to
>>            your file using 'set sdfwrite file.nc <http://file.nc>'
>>
>>            followed by 'sdfwrite acc'.
>>            Maybe the following will give you more info.
>>
>>            I quote from Bob Kuligowski:
>>
>>            "GrADS can produce numerous types of file displays using
>>            gridded data using set gxout:
>>
>>            bar    (bar chart)               line    (line graph)
>>            barb    (wind barbs)               linefill (color fill between
>> two lines)
>>            contour    (contour plot)               scatter    (scatter
>> plot)
>>            errbar    (error bars)               shaded    (shaded contour
>> plot)
>>            grfill    (shaded grid boxes)               stream    (wind
>> streamlines)
>>            fgrid    (grid boxes shaded for specified values)
>> vector    (wind vector arrows)
>>            grid    (grid boxes with printed values)"
>>
>>            Hope it can help,
>>
>>            Regards,
>>
>>            Serge
>>
>>
>>
>>            2011/6/21 gabriel gavinho <gavinho.gabriel at gmail.com
>>            <mailto:gavinho.gabriel at gmail.**com<gavinho.gabriel at gmail.com>
>> >>
>>
>>
>>                Dear Users
>>
>>                I am having a hard time trying to sum the values for
>>                daily precipitation during a month, in order put
>>                together both daily values and the accumulative sum in
>>                the same graphic
>>                Can you help me?
>>
>>                regards!
>>
>>                Gabriel Gavinho
>>                Federal University of Rio de Janeiro
>>
>>                ______________________________**_________________
>>                gradsusr mailing list
>>                gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>>
>>                http://gradsusr.org/mailman/**listinfo/gradsusr<http://gradsusr.org/mailman/listinfo/gradsusr>
>>
>>
>>
>>
>>            --             Serge
>>
>>            ______________________________**_________________
>>            gradsusr mailing list
>>            gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>>
>>            http://gradsusr.org/mailman/**listinfo/gradsusr<http://gradsusr.org/mailman/listinfo/gradsusr>
>>
>>
>>
>>
>>
>>    --     Serge
>>
>>
>>
>> ------------------------------**------------------------------**
>> ------------
>>
>> ______________________________**_________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/**listinfo/gradsusr<http://gradsusr.org/mailman/listinfo/gradsusr>
>>
>
> --
>
> Please note that Charles.Seman at noaa.gov should be considered my NOAA
> email address, not cjs at gfdl.noaa.gov.
>
> ************************************************************************
>  Charles Seman                                Charles.Seman at noaa.gov
>  U.S. Department of Commerce / NOAA / OAR
>  Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
>  201 Forrestal Road                              fax: (609) 987-5063
>  Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
> ************************************************************************
>
> "The contents of this message are mine personally and do not reflect any
> official or unofficial position of the United States Federal Government,
> the United States Department of Commerce, or NOAA."
>
> *
> * credit for technique: Vaughan Phillips
> *
> 'reinit'
> 'open ifamean.ctlt'
> 'set x 1'
> 'set y 1'
> 'set z 1'
> 'set t 393 440'
> *
> * note: prec in units of (mm/h), dt = 3 hours, paccum in units of (mm)
> *
> dt=3
> 'paccum = 'dt'*tloop(sum(prec,t=393,t+0))'
> 'enable print prec_accum.gx'
> 'set vrange 0. 200.'
> 'd paccum'
> 'draw title TOGA Accumulated Precipitation'
> 'draw ylab (mm)'
> 'print'
> 'disable print'
> '!gxps -c -d -i prec_accum.gx -o prec_accum.ps'
> '!gzip -f prec_accum.ps'
> '!rm prec_accum.gx'
>
> DSET ^ifamean.grt
> UNDEF -9.99e22
> TITLE gcss 2 observed IFA Mean data
> OPTIONS big_endian
> *
> XDEF    1 LINEAR 1 1
> *
> YDEF    1 LINEAR 1 1
> *
> ZDEF    1 LINEAR 1 1
> *
> TDEF   960 LINEAR 01Nov1992    3hr
> *
> VARS  11
> ws     0 99 960 Wind Speed (m/s)
> sst    0 99 960 Sea Surface Temperature (C)
> airt   0 99 960 Surface Air Temperature (C)
> qa     0 99 960 Mixing Ratio (g/kg)
> prec   0 99 960 Precipitation Rate (mm/h)
> shf    0 99 960 Sensible Heat Flux (w/m^2)
> lhf    0 99 960 Latent Heat Flux (w/m^2)
> swr_d  0 99 960 Downward Solar Radiative Flux (w/m^2)
> swr_u  0 99 960 Upward Solar Radiative Flux (w/m^2)
> lwr_d  0 99 960 Downward Infrared Radiative Flux (w/m^2)
> lwr_u  0 99 960 Upward Solar Radiative Flux (w/m^2)
> ENDVARS
>
> _______________________________________________
> 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/20110622/f63e0f15/attachment-0003.html 


More information about the gradsusr mailing list