[gradsusr] Creating a Binary File in Grads

Valeria Benson-Lira vbensonl at asu.edu
Sat Jan 24 00:41:30 EST 2015


Dear Grads users,

Can someone please help me with my script? I am trying to write a binary
file that contains all the values recorded in four different control files.
My new binary file will have the hourly precipitation records from April
through July. So far, the script works for the first month but not for the
following months.

This is the script:


'reinit'

'open ENCB1_precip_apr2008.ctl'

'open ENCB1_precip_may2008.ct'

'open ENCB1_precip_jun2008.ctl'

'open ENCB1_precip_july2008.ctl'


'set gxout fwrite'

'set fwrite ENCB1_AMJJ_precip.dat '


*****Write April data First.

*****Recall that April has 720 hours (30 days)

*index*_t = 1

while(*index*_t<=720)

  'set t '*index*_t

  say *index*_t

  'd precip.1 '

  *index*_t = *index*_t + 1

endwhile


*****Write May data Next.

*****Recall that May has 744 hours (31 days)

*index*_t = 1

while(*index*_t<=744)

  'set t '*index*_t

  say *index*_t

  'd precip.2 '

  *index*_t = *index*_t + 1

endwhile


*****Write June data Next.

*****Recall that June has 720 hours (30 days)

*index*_t = 1

while(*index*_t<=720)

  'set t '*index*_t

  say *index*_t

  'd precip.3 '

  *index*_t = *index*_t + 1

endwhile


*****Write July data Next.

*****Recall that July has 744 hours (31 days)

*index*_t = 1

while(*index*_t<=744)

  'set t '*index*_t

  say *index*_t

  'd precip.4 '

  *index*_t = *index*_t + 1

endwhile


*************************

'disable fwrite'

*************************

*****Always reinitialize when finished,

*****to avoid mistakingly writing extraneous data

'reinit'


Do you have a suggestion of how I can fix it?

Thanks,

*Valeria Benson-Lira*
*Graduate Teaching Assistant, Geography M.A.*
*e-mail: vbensonl at asu.edu <vbensonl at asu.edu>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150123/3fab7bd5/attachment-0001.html 


More information about the gradsusr mailing list