Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^2: Ocean tides in Perl

by pvaldes (Chaplain)
on Nov 01, 2011 at 10:18 UTC ( #935085=note: print w/replies, xml ) Need Help??

in reply to Re: Ocean tides in Perl
in thread Ocean tides in Perl

In general tide calculations are horribly complicated

YES, this is what make a project like this so dificult and thus so "sexy". A very unusual problem here in the monastery.

but also by the topography of the sea floor in the "local" area

yep ...and don't forget the barometric pressure. The local parameters are important.

A lot of parameters should be in any of the modules managing time/localtime, other groups in modules belonging to Math and Astro categories, and a fourth set should be calculated for the specific area and probably need to be measured in the field. If I could make a wish I will add also a plotting method at the end, (maybe Graphics::Timeline or something equivalent).

Writing a Perl module to perform the required calculations would not be particularly hard

I agree

but the result is likely to be slow

Well this is an advice that I will take seriously. Can I abuse of your time and knowledge and ask you to explore this a little more GrandFather?, do you honestly think that this would be a major obstacle to do this in Perl? (instead i.e. C). Generally speaking of course, how this problem could be avoided? (i.e not choosing a time-module know for being slow etc...)

Replies are listed 'Best First'.
Re^3: Ocean tides in Perl
by GrandFather (Sage) on Nov 01, 2011 at 11:13 UTC

    Well, I have about 500 lines of C that uses a 37 coefficient set to perform tide prediction calculations but it's not code I can release to the public domain (I don't have ownership of it) and I'm not sure I could legally derive a Perl equivalent from it. However, it's pretty much solid calculation so the equivalent Perl wouldn't be a heck of a lot smaller. You can gauge from that the size of the coding task. Oh, and I don't know how compatible that set of parameters may be with publicly available tide parameter sets so the whole thing could be a complete waste of time in any case.

    To be of any practical use a tide calculation module would need to use a set of parameters for which data is publicly available. It's about 10 years since I worked on any of this stuff so maybe things are different now, but then the data was considered valuable and was hard to come by. Because of the potential difficulty in getting data I'd think there would be little call for such a module in CPAN. My involvement in such calculations has long since passed so I have no particular current interest in creating such a module.

    True laziness is hard work

      About 20+ years ago, I wrote a small basic program for a Yacht Club. The data was available from a US government agency for a specific geographic location. The Yacht Club knew that their location was 1 hour 22 minutes behind the tide for that specific geographic location. With that information the program produced a chart something like the following for the entire year:

      Tides for ____________________ starting with November 1, 2011. Day High Tide Height Sunrise Moon Time % Moon /Low Time Feet Sunset Visible Tu 1 High 3:41 AM 3.0 7:43 AM Rise 1:23 PM 31 1 Low 11:14 AM 0.2 6:47 PM 1 High 5:57 PM 2.2 1 Low 11:06 PM 1.1

      The only calculations the program made was to adjust the 'Tide Time'. For perl to do this the script would be trivial.

      From this discussion, it sounds like I needed to account for a lot more. Isn't tide predicting mostly an approximation?

      "Well done is better than well said." - Benjamin Franklin

        For approximate times that technique is ok but gets worse the further separated the reference station and the point of interest are. The error is also a strong function of local sea floor topology. However if you are interested in tide height rather than just times of slack water then this technique can degrade rapidly over fairly short distances.

        True laziness is hard work
        Has been 20 years, but do you still have the code that generated that chart?
      I can understand the reasons of any monk to be reluctant to show any code that is the result of many hours of hard work and I'm sure that the other monks think the same; in any case your reply sheds a lot of light on the subject and I think it points the OP in the right direction. In short, excelent advice, very illustrative to me, thank you.

        You misunderstand. It's not my code to give. It was someone else's code I used to solve a problem for yet another person. The person I was solving the problem for obtained the code (legally) for the express purpose of solving a specific problem from the company that owned the code.

        True laziness is hard work
Re^3: Ocean tides in Perl
by Anonymous Monk on Nov 01, 2011 at 19:52 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://935085]
[LanX]: It seems that PHP's official docs use "closure" and "anonymous function" interchangeably, even though their closures don't capture surrounding state without using the 'use' language construct.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2018-02-23 17:07 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (303 votes). Check out past polls.