Hello Aldebaran,

Regarding the time, from what I read in the documentation of Universal-time of Astro::Coord::ECI, it should be seconds since the Linux (lololol) Unix Epoch in UTC (Coordinated Universal Time) time zone. Which is what you get from a DateTime's epoch() method. So, I think this is correct:

my $sta = Astro::Coord::ECI-> universal ($start_time_dateobj->epoch())-> geodetic ($lat, $long, $alt);

In general, if you ever need to convert between time zones, here is some extra information. The startTime you get from the api.weather.gov already contains a timezone. I remember output like 2020-04-26T06:00:00-05:00. Interesting question is what place's that time zone (-05:00) is: the enquiring coordinates or the enquirer's computer location (unlikely). You can deduce that by running a couple of tests for far away locations.

A quick refresher on timezones from wikipedia tells us:

Negative UTC offsets describe a time zone west of UTC±00:00, where the civil time is behind (or earlier) than UTC so the zone designator will look like "−03:00","−0300", or "−03".

Positive UTC offsets describe a time zone east of UTC±00:00, where the civil time is ahead (or later) than UTC so the zone designator will look like "+02:00","+0200", or "+02".

Examples 

    "−05:00" for New York on standard time (UTC-05:00)
    "−04:00" for New York on daylight saving time (UTC-04:00)
    "+00:00" (but not "-00:00") for London (UTC±00:00)
    "+02:00" for Cairo (UTC+02:00)
    "+05:30" for Mumbai (UTC+05:30)
    "+14:00" for Kiribati (UTC+14:00)

If you must set a new timezone for a DateTime object: e.g. UTC (universal time; I have just learned that its name was born out of perfect delicate diplomatic balance) (equivalent to GMT for the layman). You can do it like this: my $UTCdateobj = $start_time_dateobj->set_time_zone('UTC');

Given sun's relative position, the incoming solar energy per unit area can then be calculated, e.g. https://www.grc.nasa.gov/www/k-12/Numbers/Math/Mathematical_Thinking/sun12.htm

btw, your link to Astro::Coord::ECI::Sun should be formatted as [mod://Astro::Coord::ECI::Sun] and not as [Astro::Coord::ECI::Sun].

bw, bliako


In reply to Re: getting Sun info with Astro::Coord::ECI::Sun by bliako
in thread getting Sun info with Astro::Coord::ECI::Sun by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.