John,

Your reaction was what my original reaction was until I realized I had to
find out what a DEM file was and that contains enough of the kind of
depth-dimension data you describe albeit what may be a very irregular cross
section to calculate for areas and thence volumes.

If I read it correctly, this can be a very real-world problem worthy of a
solution, such as in places like California where they had a tad more rain
than usual and some reservoirs may overflow. Someone else provided what
sounds like a mathematical algorithm but my guess is what is needed here is
perhaps less analytic since there may be no trivial way to create formulas
and take integrals and so on, but simply an approximate way to calculate
incremental volumes for each horizontal "slice" and keep adding or
subtracting them till you reach a target and then read off another variable
at that point such as depth.

Some care must be taken as water level has to be relative to something and
many natural reservoirs have no unique bottom level. Some water may also be
stored underground and to the side and pour in if the level lowers or can be
used to escape if the level rises.


-----Original Message-----
From: R-help <r-help-boun...@r-project.org> On Behalf Of Sorkin, John
Sent: Sunday, April 7, 2024 3:08 PM
To: Rui Barradas <ruipbarra...@sapo.pt>; javad bayat <j.bayat...@gmail.com>;
R-help <R-help@r-project.org>
Subject: Re: [R] Question regarding reservoir volume and water level

Aside from the fact that the original question might well be a class
exercise (or homework), the question is unanswerable given the data given by
the original poster. One needs to know the dimensions of the reservoir,
above and below the current waterline. Are the sides, above and below the
waterline smooth? Is the region currently above the waterline that can store
water a mirror image of the region below the waterline? Is the region above
the reservoir include a flood plane? Will the additional water go into the
flood plane?

The lack of required detail in the question posed by the original poster
suggests that there are strong assumptions, assumptions that typically would
be made in a class-room example or exercise.

John

John David Sorkin M.D., Ph.D.
Professor of Medicine, University of Maryland School of Medicine;
Associate Director for Biostatistics and Informatics, Baltimore VA Medical
Center Geriatrics Research, Education, and Clinical Center;
PI Biostatistics and Informatics Core, University of Maryland School of
Medicine Claude D. Pepper Older Americans Independence Center;
Senior Statistician University of Maryland Center for Vascular Research;

Division of Gerontology and Paliative Care,
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
Cell phone 443-418-5382




________________________________________
From: R-help <r-help-boun...@r-project.org> on behalf of Rui Barradas
<ruipbarra...@sapo.pt>
Sent: Sunday, April 7, 2024 10:53 AM
To: javad bayat; R-help
Subject: Re: [R] Question regarding reservoir volume and water level

Às 13:27 de 07/04/2024, javad bayat escreveu:
> Dear all;
> I have a question about the water level of a reservoir, when the volume
> changed or doubled.
> There is a DEM file with the highest elevation 1267 m. The lowest
elevation
> is 1230 m. The current volume of the reservoir is 7,000,000 m3 at 1240 m.
> Now I want to know what would be the water level if the volume rises to
> 1250 m? or what would be the water level if the volume doubled (14,000,000
> m3)?
>
> Is there any way to write codes to do this in R?
> I would be more than happy if anyone could help me.
> Sincerely
>
>
>
>
>
>
>
>
Hello,

This is a simple rule of three.
If you know the level l the argument doesn't need to be named but if you
know the volume v then it must be named.


water_level <- function(l, v, level = 1240, volume = 7e6) {
   if(missing(v)) {
     volume * l / level
   } else level * v / volume
}

lev <- 1250
vol <- 14e6

water_level(l = lev)
#> [1] 7056452
water_level(v = vol)
#> [1] 2480


Hope this helps,

Rui Barradas


--
Este e-mail foi analisado pelo software antivírus AVG para verificar a
presença de vírus.
http://www.avg.com/

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.r-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to