Author Topic: Slow loading main index (Update usno.mil applications server is down fix below )  (Read 10024 times)

0 Members and 1 Guest are viewing this topic.

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
That's what I was referring to back in my reply #24...
Don - W3DRM - Emmett, Idaho --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KBOI7
Davis Wireless VP2, WD 10.37s150,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam (off-line)
--- RIPE Atlas Probe - 32849

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6364
    • Valentine Nebraska's Real-Time Weather
That's what I was referring to back in my reply #24...

Yes thanks, I saw that post and went back to check. Like I said not sure if this is the fix. Ken will need to verify but using aa does work for now also.
« Last Edit: November 26, 2016, 10:14:44 PM by ValentineWeather »
Randy

Offline lrosenman

  • Contributor
  • ***
  • Posts: 148
    • Siena Weather
the DNS is back.  When it was broke, ANYTHING in *.usno.navy.mil was NOT resolving.

they both resolve to the same IP:
Quote
LER-MAC-3301:~ lrosenma$ host api.usno.navy.mil
api.usno.navy.mil has address 199.211.133.93
LER-MAC-3301:~ lrosenma$ host aa.usno.navy.mil
aa.usno.NAVY.mil has address 199.211.133.93
aa.usno.navy.mil mail is handled by 20 sec-jeemsg.eemsg.mail.mil.
aa.usno.navy.mil mail is handled by 30 guardian.usno.navy.mil.
aa.usno.navy.mil mail is handled by 10 pri-jeemsg.eemsg.mail.mil.
LER-MAC-3301:~ lrosenma$

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6364
    • Valentine Nebraska's Real-Time Weather
So when api goes down so does aa, I wasn't sure thanks for checking. Well then back to IP address.
Randy

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Their API docs still say use api.usno.navy.mil for the queries.

As lrosenman says, the *.usno.navy.mil sites are ALL down when the usno.navy.mil zone is not working--only the ip address bypasses that (since no lookup for a hostname->IP address is needed).  But.. that comes with a risk of breaking if they move that service to a different IP address.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
I got home from work yesterday at 1AM so it took me a bit longer to finish it and when I was done at 5:30 AM I thought I will leave sending it to Ken for today :D

Either way, I just emailed Ken the scripts I prepared with all the necessary functions included and it worked perfectly (at least for my location and timezone...). Let's see, if it works for Ken as well it could replace the original scripts that use USNO. The ones I sent calculate everything inside the script.

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6364
    • Valentine Nebraska's Real-Time Weather
Good deal thanks Jáchym. We need something more reliable, at least I do with the 34 second delay I was experiencing before.
Randy

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
LOL, yes I can imagine... here we are talking miliseconds ;)

Offline lrosenman

  • Contributor
  • ***
  • Posts: 148
    • Siena Weather
Their API docs still say use api.usno.navy.mil for the queries.
To put a fine point on it, they MIGHT some day move api.usno.navy.mil to a different IP address than aa.usno.navy.mil.

So, using the DNS is the right answer.  (hopefully they keep it up....)

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6364
    • Valentine Nebraska's Real-Time Weather
LOL, yes I can imagine... here we are talking miliseconds ;)

I was talking about page load time for me.
As far as correct sunrise sunset I've noticed the times seem off, but not absolutely sure what is considered sunset.

Is its when the sun ball has completely disappeared or not. My sun sets about 4 minutes earlier than what UNSO.mil says and I've got photos showing, but like I said what's exact criteria for complete sunset not sure. 
I'll post a series from yesterday the time on image is within 3 seconds of accuracy. Official sunset is 5:11 and it looks to actually set at 5:07 on a straight flat horizon.
Randy

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
This is defined by the angle of the Sun disc. In the script I sent to Ken I used the official numbers used, but they could of course differ in different scripts.

What I used is 90.5 for sunrise/sunset, 102 for nautical twilight, 108 for astronomical and 96 for civil. You can easily change it in the script.

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
While we are waiting for Ken to do his magic...

Jachym, are these values based on a flat terrain? For example, I live in a valley with 9,000+ foot mountains all around me so the official calculated sunrise/sunset times are always many minutes off from what we experience locally. I don't expect any of the times to be accurate for all locations but, was wondering if the calculations are made for some kind of standard earth curvature value without terrain being a factor.
Don - W3DRM - Emmett, Idaho --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KBOI7
Davis Wireless VP2, WD 10.37s150,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam (off-line)
--- RIPE Atlas Probe - 32849

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
I guess the calculations would also be off, it does not take into account elevation. I might try to look this up, sun rise/set in particular is relatively easy in PHP, there is a built-in PHP function for it where you just specify the angle you want (for sunrise/set I used 90.5) and the coordinates and timezone. But I will see if there is some correction that could be calculated and applied. My guess these are all based on sea-level, which for majority will be very close to the actual value

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Looks like it would technically be possible, but some major changes would have to be made in the script and lots of functions added... maybe sometimes when Im too tired to do something for meteotemplate at 4AM :D

http://photo.stackexchange.com/questions/30259/how-to-adjust-sunrise-and-sunset-times-according-to-altitude

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
Probably not worth the time and effort as every location on earth would have a different setting. What made me think about it is there are some software packages used to calculate radio transmission patterns. They use both lat/lon and topographical feature maps to determine the estimated radiation patterns from an antenna that is x feet above ground. This kind of information is important for commercial and amateur radio operators when determining the best location and elevation to place a transmitter for maximum coverage.

Carrying the above technology forward as a means of determining the exact sunrise/sunset times anywhere on earth should be feasible. But, as I said, it's probably not worth the time and effort it would take to put something like this together as it would also have to include all of the variables around the movement of the earth and the sun to come up with the correct calculation.

Also, did you change your avatar image? Must be an updated photo of yourself?
Don - W3DRM - Emmett, Idaho --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KBOI7
Davis Wireless VP2, WD 10.37s150,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam (off-line)
--- RIPE Atlas Probe - 32849

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
It probably isnt that difficult, it is some approximation based on latitude and altitude.

OT: Yes I did :D I sort of came to conclusion I should update my 5yr old photo when I was 24 :D

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Probably not worth the time and effort as every location on earth would have a different setting. What made me think about it is there are some software packages used to calculate radio transmission patterns. They use both lat/lon and topographical feature maps to determine the estimated radiation patterns from an antenna that is x feet above ground. This kind of information is important for commercial and amateur radio operators when determining the best location and elevation to place a transmitter for maximum coverage.

Carrying the above technology forward as a means of determining the exact sunrise/sunset times anywhere on earth should be feasible. But, as I said, it's probably not worth the time and effort it would take to put something like this together as it would also have to include all of the variables around the movement of the earth and the sun to come up with the correct calculation.

According to the USNO FAQ
Quote
Horizon: Wherever one is located on or near the Earth's surface, the Earth is perceived as essentially flat and, therefore, as a plane. The sky resembles one-half of a sphere or dome centered at the observer. If there are no visual obstructions, the apparent intersection of the sky with the Earth's (plane) surface is the horizon, which appears as a circle centered at the observer. For rise/set computations, the observer's eye is considered to be on the surface of the Earth, so that the horizon is geometrically exactly 90 degrees from the observer's zenith.

Rise, Set: During the course of a day the Earth rotates once on its axis causing the phenomena of rising and setting. Excluding circumpolar objects, celestial bodies – stars and planets included – seem to appear in the sky at the horizon to the East of any particular place, then to cross the sky and again disappear at the horizon to the West. The most noticeable of these events, and the most significant in regard to ordinary affairs, are the rising and setting of the Sun and Moon. Because the Sun and Moon appear as circular disks and not as points of light, a definition of rise or set must be very specific because not all of either body is seen to rise or set at once.

    Sunrise and sunset conventionally refer to the times when the upper edge of the disk of the Sun is on the horizon. Atmospheric conditions are assumed to be average, and the location is in a level region on the Earth's surface.

    Moonrise and moonset times are computed for exactly the same circumstances as for sunrise and sunset. However, moonrise and moonset may occur at any time of day and, consequently, it is often possible for the Moon to be seen during daylight, and to have moonless nights. It is also possible that a moonrise or moonset does not occur relative to a specific place on a given date.

Transit: The transit time of a celestial body refers to the instant that its center crosses an imaginary line in the sky - the observer's meridian - running from north to south. For observers in low to middle latitudes, transit is approximately midway between rise and set, and represents the time at which the body is highest in the sky on any given day. At high latitudes, neither of these statements may be true - for example, there may be several transits between rise and set. The transit of the Sun is local solar (sundial) noon. The difference between the transit times of the Sun and Moon is closely related to the Moon's phase. The New Moon transits at about the same time as the Sun; the First Quarter Moon transits about 6 hours after the Sun; the Full Moon transits about 12 hours after/before the Sun; and the Last Quarter Moon transits about 6 hours before the Sun.

Twilight: Before sunrise and again after sunset there are intervals of time, twilight, during which there is natural light provided by the upper atmosphere, which does receive direct sunlight and reflects part of it toward the Earth's surface. Some outdoor activities may be conducted without artificial illumination during these intervals, and it is useful to have some means to set limits beyond which a certain activity should be assisted by artificial lighting. The major determinants of the amount of natural light during twilight are the state of the atmosphere generally and local weather conditions in particular. Atmospheric conditions are best determined at the actual time and place of events. Nevertheless, it is possible to establish useful, though necessarily approximate, limits applicable to large classes of activities by considering only the position of the Sun below the local horizon. Reasonable and convenient definitions have evolved.

    Civil twilight is defined to begin in the morning, and to end in the evening when the center of the Sun is geometrically 6 degrees below the horizon. This is the limit at which twilight illumination is sufficient, under good weather conditions, for terrestrial objects to be clearly distinguished; at the beginning of morning civil twilight, or end of evening civil twilight, the horizon is clearly defined and the brightest stars are visible under good atmospheric conditions in the absence of moonlight or other illumination. In the morning before the beginning of civil twilight and in the evening after the end of civil twilight, artificial illumination is normally required to carry on ordinary outdoor activities.

    Nautical twilight is defined to begin in the morning, and to end in the evening, when the center of the sun is geometrically 12 degrees below the horizon. At the beginning or end of nautical twilight, under good atmospheric conditions and in the absence of other illumination, general outlines of ground objects may be distinguishable, but detailed outdoor operations are not possible. During nautical twilight the illumination level is such that the horizon is still visible even on a Moonless night allowing mariners to take reliable star sights for navigational purposes, hence the name.

    Astronomical twilight is defined to begin in the morning, and to end in the evening when the center of the Sun is geometrically 18 degrees below the horizon. Before the beginning of astronomical twilight in the morning and after the end of astronomical twilight in the evening, scattered light from the Sun is less than that from starlight and other natural sources. For a considerable interval after the beginning of morning twilight and before the end of evening twilight, sky illumination is so faint that it is practically imperceptible.

Technical Definitions and Computational Details

Sunrise and sunset. For computational purposes, sunrise or sunset is defined to occur when the geometric zenith distance of center of the Sun is 90.8333 degrees. That is, the center of the Sun is geometrically 50 arcminutes below a horizontal plane. For an observer at sea level with a level, unobstructed horizon, under average atmospheric conditions, the upper limb of the Sun will then appear to be tangent to the horizon. The 50-arcminute geometric depression of the Sun's center used for the computations is obtained by adding the average apparent radius of the Sun (16 arcminutes) to the average amount of atmospheric refraction at the horizon (34 arcminutes).

Moonrise and moonset. Moonrise and moonset are defined similarly, but the situation is computationally more complex because of the nearness of the Moon and the eccentricity of its orbit. If the computations are carried out using coordinates of the Moon with respect to the Earth's center (the usual method), then moonrise or moonset is defined to occur when the geometric zenith distance of the center of the Moon is

    90.5666 degrees + Moon's apparent angular radius - Moon's horizontal parallax

Under normal atmospheric conditions at sea level, the upper limb of the Moon will then appear to be tangent with a level, unobstructed horizon. No account is taken of the Moon's phase; that is, the Moon is always regarded as a disk in the sky and the upper limb might be dark. Here again, a constant of 34 arcminutes (0.5666 degree) is used to account for atmospheric refraction. The Moon's apparent radius varies from 15 to 17 arcminutes and its horizontal parallax varies from 54 to 61 arcminutes. Adding all the terms above together, the center of the Moon at rise or set is geometrically 5 to 10 arcminutes above the observer's "geocentric horizon" - the horizontal plane that passes through the Earth's center, orthogonal to the observer's local vertical.

Accuracy of rise/set computations. The times of rise and set phenomena cannot be precisely computed, because, in practice, the actual times depend on unpredictable atmospheric conditions that affect the amount of refraction at the horizon. Thus, even under ideal conditions (e.g., a clear sky at sea) the times computed for rise or set may be in error by a minute or more. Local topography (e.g., mountains on the horizon) and the height of the observer can affect the times of rise or set even more. It is not practical to attempt to include such effects in routine rise/set computations.

The accuracy of rise and set computations decreases at high latitudes. There, small variations in atmospheric refraction can change the time of rise or set by many minutes, since the Sun and Moon intersect the horizon at a very shallow angle. For the same reason, at high latitudes, the effects of observer height and local topography are magnified and can substantially change the times of the phenomena actually observed, or even whether the phenomena are observed to occur at all.

Twilight. There are three kinds of twilight defined: civil twilight, nautical twilight, and astronomical twilight. For computational purposes, civil twilight begins before sunrise and ends after sunset when the geometric zenith distance of the center of the Sun is 96 degrees - 6 degrees below a horizontal plane. The corresponding solar zenith distances for nautical and astronomical twilight are 102 and 108 degrees, respectively. That is, at the dark limit of nautical twilight, the center of the Sun is geometrically 12 degrees below a horizontal plane; and at the dark limit of astronomical twilight, the center of the Sun is geometrically 18 degrees below a horizontal plane.

So.. elevation is NOT taken into account from the USNO calculations.  I don't think any of the weather software programs who report rise/set times take it into the calculations either.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3360
    • Emmett Weather
Whew, leave it to the government to come up with this level of detail... Lots of good info though. Thanks for finding this and enhancing our knowledge of the subject!

Here is a link to the software I was referring to in my earlier reply:
It doesn't really apply to what we are trying to do here but, I thought it might pique someone's interest when considering topography and altitude/elevation from a given lat/lon.
« Last Edit: November 27, 2016, 06:18:25 PM by W3DRM »
Don - W3DRM - Emmett, Idaho --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KBOI7
Davis Wireless VP2, WD 10.37s150,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam (off-line)
--- RIPE Atlas Probe - 32849

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Making a function to take this into account really shouldnt be that difficult based on this:
Quote
Using trigonometry, for every degree north or south you travel, the extra time the sun would stay above the horizon (per 1.5km altitude) would be (1/cos (latitude)) * 1 minute per 1.5km

The only problem I have is that once I make that function I have no way of testing if it is actually the right time since I live only 230m above sea level and none of the major websites take it into account :D

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Ken I just emailed you an updated version of the solar calculations, it takes into account the altitude and I checked it on one website and it seems to be working, wasnt that difficult in the end.

Offline ValentineWeather

  • Forecaster
  • *****
  • Posts: 6364
    • Valentine Nebraska's Real-Time Weather
Maybe you could test using this. http://www.esrl.noaa.gov/gmd/grad/solcalc/
Randy

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
Maybe you could test using this. http://www.esrl.noaa.gov/gmd/grad/solcalc/

Not really because I didnt find any option to specify the elevation, you only give co-ordinates. I know I got that right but I wanted to test that the correction for elevation generates correct times.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Ken I just emailed you an updated version of the solar calculations, it takes into account the altitude and I checked it on one website and it seems to be working, wasnt that difficult in the end.
Got it, thanks...

The current Saratoga templates don't have a $SITE['elevation'] entry, so I'm not sure if it would be useful to incorporate it for a bit of extra sunrise/set info v.s. the built-in PHP suntimes functions.  I think I'll stick with the values that compare to the USNO and http://www.esrl.noaa.gov/gmd/grad/solcalc/ results which are for sea level/flat horizon. 

It's interesting that the esrl site used the Astronomical Algorithms from Jean Meeus -- I have that book (second edition) -- chapters 47-53 deal with the moon and lunar equations.  It's all mathematical notation.. not computer code :(
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline Jáchym

  • Meteotemplate Developer
  • Forecaster
  • *****
  • Posts: 8605
    • Meteotemplate
In MT I have a variable for elevation so I might add that in v11. Right now it is also not taken into account.

And yes I know that book very well :D I read parts of it while making those scripts and converting some of the equations to PHP about a yr ago. Interesting read, though quite complicated in some sections :D

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 5509
    • KomokaWeather

Quote
It's all mathematical notation.. not computer code :(
and would you expect anything different ;)
Quote
His area of interest is spherical and mathematical astronomy
https://en.wikipedia.org/wiki/Jean_Meeus


Paul