in reply to getting Sun info with Astro::Coord::ECI::Sun

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

Replies are listed 'Best First'.
Re^2: getting Sun info with Astro::Coord::ECI::Sun
by marto (Cardinal) on May 24, 2020 at 10:19 UTC

    "btw, your link to Astro::Coord::ECI::Sun should be formatted as.."

    Your link calls a search on search.cpan, which redirects to metacpan. Cut out the middle man [metamod://Astro::Coord::ECI::Sun] -> Astro::Coord::ECI::Sun.

Re^2: getting Sun info with Astro::Coord::ECI::Sun
by perlfan (Parson) on May 23, 2020 at 18:18 UTC
    >calculated

    not to mess up such a nice OP and reply, but since you used that word quoted above, I thought I'd mention the PDL for general purpose computations in the scientific realm.
Re^2: getting Sun info with Astro::Coord::ECI::Sun
by Aldebaran (Curate) on May 30, 2020 at 01:34 UTC
    So, I think this is correct:   universal ($start_time_dateobj->epoch()

    Yes, I think so too. I may be re-ordering your response, because I don't have time to do a *good* write-up, just a sufficient one.

    your link to Astro::Coord::ECI::Sun should be formatted as Astro::Coord::ECI::Sun and not as Astro::Coord::ECI::Sun

    Thanks for the tip. How does a person strike out characters, like you did with 'Linux'?

    UTC (universal time; I have just learned that its name was born out of perfect delicate diplomatic balance) (equivalent to GMT for the layman)

    ...imagine that, we settled for Her Majesty at the center of the time world, of the empire on which the sun does not set....

    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". "+14:00" for Kiribati (UTC+14:00)

    This was fascinating. These islands are below Hawaii. (You know, because north is up). We're at minus 7 for PDT (Pacific Daylight Time). What decides when someone's day starts? Is it 12 am local? (Is that a given?)

    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.

    I'm still testing and trying to make sense of what I have. I'm gonna put output and source between readmore tags:

    [Consider:] my $UTCdateobj = $start_time_dateobj->set_time_zone('UTC');

    I did not use this line, and it might be why I don't succeed.

    Anyways, thanks for your post, bliako, and your perspective from the world of positive time offsets. We'll be in the high desert this weekend, and you can be sure I'll have a weather report to take some of the guesswork out of it. Occasionally, the "data" can be quite beautiful: pictures of clouds (with data!)

      The thing that is not attaining is that the Altitude and Azimuth values are not changing as $start_time_dateobj does

      I am the last to dispense advise on celestial mechanics but I see all values changing.

      ...imagine that, we settled for Her Majesty at the center of the time world, of the empire on which the sun does not set....

      that's funny!