On Thu, Aug 29, 2013 at 5:40 AM, jim holtman <jholtman@gmail.com> wrote:

> Here is how I would do it since are reading in the entire file.  This
> breaks on each "Flow Budget" section, extracts the RECHARGE values and
> puts them in a list with the name of the Flow Budget:
>

I learned more R in studying your solution than I could've in a week
devoted to googling R.  Thank you for making short work of the problem.


> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
>
To answer your question, I'm simply trying to plot various components of
the flow budget (e.g., recharge, lake seepage) for any zone that I name
through time.  For example, I tried altering your solution to restrict the
retrieved output to zone 2 only:

indx <- grep("Flow Budget for Zone  2|  RECHARGE =", input)

But this was wholly unsatisfactory because I got recharge for all the other
zones as well:

 [1] "                          RECHARGE =   0.12898E+06"
 [2] "                          RECHARGE =    0.0000    "
 [3] "     Flow Budget for Zone  2 at Time Step   1 of Stress Period   2"
 [4] "                          RECHARGE =   0.27416E+06"
 [5] "                          RECHARGE =    0.0000    "
 [6] "                          RECHARGE =    81084.    "
 [7] "                          RECHARGE =    0.0000    "
 [8] "                          RECHARGE =    45295.    "
 [9] "                          RECHARGE =    0.0000    "
[10] "                          RECHARGE =    71834.    "
[11] "                          RECHARGE =    0.0000    "
[12] "                          RECHARGE =    97739.    "
[13] "                          RECHARGE =    0.0000    "
[14] "                          RECHARGE =   0.12100E-01"
[15] "                          RECHARGE =    0.0000    "
[16] "                          RECHARGE =    25350.    "
[17] "                          RECHARGE =    0.0000    "
[18] "                          RECHARGE =    6167.2    "
[19] "                          RECHARGE =    0.0000    "
[20] "                          RECHARGE =    28608.    "
>

My thinking at this point is to amend your original solution to account for
"composite zones":

indx <- grep("Flow Budget for Zone|Flow Budget for Composite Zone|RECHARGE
=", input)

and from this extract zone 2's "RECHARGE", or composite zone 10's "LAKE
SEEPAGE", etc.  So from the output as I now have it (example shown below),
how does one search this form of output for zone 2, or composite zone 10?



and leaving the rest of the R as is, I get processed results not unlike
what you showed, only with composite zones taken into acct (shown below).
 So, the final step of "what" I like to do is to then plot a time series of
"RECHARGE" (not including "UZF RECHAGE") for Zone 2, or plot "LAKE SEEPAGE"
for "Composite Zone 10" over all 574 stress periods.



result[1:100]
$`     Flow Budget for Zone  1 at Time Step   1 of Stress Period   2`
[1] 128980      0

$`     Flow Budget for Zone  2 at Time Step   1 of Stress Period   2`
[1] 274160      0

$`     Flow Budget for Zone  3 at Time Step   1 of Stress Period   2`
[1] 81084     0

$`     Flow Budget for Zone  4 at Time Step   1 of Stress Period   2`
[1] 45295     0

$`     Flow Budget for Zone  5 at Time Step   1 of Stress Period   2`
[1] 71834     0

$`     Flow Budget for Zone  6 at Time Step   1 of Stress Period   2`
[1] 97739     0

$`     Flow Budget for Zone  7 at Time Step   1 of Stress Period   2`
[1] 0.0121 0.0000

...
$`     Flow Budget for Zone 94 at Time Step   1 of Stress Period   2`
[1] 0 0

$`     Flow Budget for Zone 95 at Time Step   1 of Stress Period   2`
[1] 0 0

$`     Flow Budget for Zone 96 at Time Step   1 of Stress Period   2`
[1] 0 0

$`     Flow Budget for *Composite Zone* CZ001      at Time Step   1 of
Stress Period   2`
[1] 587810      0

$`     Flow Budget for *Composite Zone* CZ002      at Time Step   1 of
Stress Period   2`
[1] 725030      0

$`     Flow Budget for *Composite Zone* CZ003      at Time Step   1 of
Stress Period   2`
[1] 1312800       0
...

	[[alternative HTML version deleted]]

