Chris, since it does indeed look like homework, albeit a deeper looks
suggests it may not beI think we can safely answer the question:

>Is there any way to write codes to do this in R?

The answer is YES.

And before you ask, it can be done in Python, Java, C++, Javascript, BASIC,
FORTRAN and probably even COBOL and many forms of assembler.

And, it can be done even without a computer using your mind and pencil and
paper.

I have seen similar problems discussed using a search and wonder if that is
where you should go, or perhaps consult your textbook or class notes.

OK, levity aside, what is the real question? 

If you want help designing an algorithm that solves the problem, that is
outside the scope of this forum and may indeed count as helping someone for
free with their homework or other work.

If this was a place for tutoring help you might  be asked to try to show
some work and point out where one step seems stuck. You might get answers.

Perhaps a better question is to look at your problem and see what it might
need and ask if someone knows of one or more R packages that handle your
needs.

But as I read your message, assume people reading it have no idea what a DEM
file is. I looked it up and it a Digital Elevation Model. I then searched to
see if anyone discussed how to bring the contents of the file into an R
session and found some suggestions but note I have not, nor plan, to try any
of them.

Your request does not specify any particular shape for the containment of
existing water or what is above. If it is from a DES file, it would have
info about what likely may be quite irregular surfaces that vary with depth.
That is not as simple a calculation as asking what happens if the container
is a cylinder or cone . It depends on the data we cannot see. It sounds way
beyond basic R as it likely involves working with 3-D matrices or something
similar.

So I looked for packages you can search for too and I see one called,
appropriately, DEM. I see other packages called Terra and CopernicusDEM  and
whitebox and you may want to do searching and see if anything solves parts
of your problem.

And, of course, it may be something you find will do it easily for you if
someone has provided say a module for Python.

Good Luck.


-----Original Message-----
From: R-help <r-help-boun...@r-project.org> On Behalf Of Chris Ryan via
R-help
Sent: Sunday, April 7, 2024 9:26 AM
To: r-help@r-project.org; javad bayat <j.bayat...@gmail.com>; R-help
<R-help@r-project.org>
Subject: Re: [R] Question regarding reservoir volume and water level

Homework?
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

On April 7, 2024 8:27:18 AM EDT, javad bayat <j.bayat...@gmail.com> wrote:
>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
>
>
>
>
>
>
>
>

______________________________________________
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