Page 4 of 6 FirstFirst ... 23456 LastLast
Results 31 to 40 of 52

Thread: New utility by Jeff Conrad: Sun/Moon calculator

  1. #31

    Join Date
    Apr 2004
    Location
    SF Bay Area, California, USA
    Posts
    331

    Re: New utility by Jeff Conrad: Sun/Moon calculator

    That's certainly an interesting idea, but it may prove a bit messy to give a reasonable implementation. In the default case, i.e., within the polar circles on days on which the Sun or Moon doesn't rise or set, it might be fairly straightforward. But in more special cases, e.g., at moderate latitudes on a day on which the Moon doesn't rise or set (there's one of each every month), results could be a bit confusing, especially if the user has specified something like 1-minute intervals for +/- 10 minutes on either side of the phenomenon that did not occur. Sun "rise" or "set" also may not occur at moderate latitudes if a nonzero altitude has been specified for rise or set; the greater the altitude, the further outside the polar circles this can happen.

    At the very least, the suggestion to manually select 0:00 and 24:00 for the display of Sun and Moon positions when rise or set do not occur should probably be added to the Help page. You obviously figured out the solution, but it may not be obvious to everyone.

    I recently found a couple of real bugs, though they won't affect most users:
    1. The latitude of Shanghai is wrong (it should be 31:14 rather than 39:14).
    2. Handling of an observer at a height greater than the surrounding terrain isn't always correct. If a nonzero Observer's Height and a nonzero rise/set altitude are both specified, the altitude is still adjusted for the observer's height--this should not happen. Furthermore, atmospheric refraction isn't included until the apparent altitude reaches zero. If an observer is substantially above the surrounding terrain, the Sun or Moon is visible at apparent altitudes less than zero, and the effect of refraction should be included. In most cases, this isn't an issue, but an observer watching the sunrise from Pikes Peak in Colorado can see the Sun at an apparent altitude of about -1.8 degrees.

    These problems will be fixed in a future version. In the meantime, there are simple workarounds for two of the issues:
    1. If the location is Shanghai, select it, then click Copy Place, select Custom Location, and edit the latitude.
    2. For an elevated observer, either ensure that a nonzero rise/set altitude is not also specified, or if a nonzero rise is required, set Observer's Height to zero. Again, this is a pretty unusual situation.

  2. #32

    Join Date
    Aug 2006
    Location
    Melbourne, Australia
    Posts
    38

    Re: New utility by Jeff Conrad: Sun/Moon calculator

    Quote Originally Posted by Jeff Conrad View Post
    Are you talking about today? If so, the rise and set azimuths for Melbourne are as they should be--you folks are in the middle of summer. The situation in the southern hemisphere is the reverse of what it is in sunny (er, rainy) San Francisco; the Sun still appears to move from east to west, but its azimuth decreases during the day, transiting to the north, and further decreasing until it sets. In the summer, rise and set are south of east and west, consistent with a longer day; in the winter, rise and set are north of east and west, with values essentially as you suggest. This is what happens, isn't it?

    Other calculators, including the U.S. Naval Observatory Data Services Sun and Moon positions page give essentially the same values as the LF calculator.
    Stop spouting and think for a minute. Melbourne is at 34° South latitude. There is NO time of the year at which the sun rises or sets south of East or West.

  3. #33
    All metric sizes to 24x30 Ole Tjugen's Avatar
    Join Date
    Mar 2002
    Location
    Norway
    Posts
    3,383

    Re: New utility by Jeff Conrad: Sun/Moon calculator

    Think for a minute:

    I'm at the opposite situation, far north.

    At midwinter, the sun rises (barely) in the south-southeast, and sets (almost immediately) in the south-southwest.

    At the equinoxes, it rises in the east and sets 12 hous later in the west.

    In the summer it rises in the north-northeast, and sets 22 hours later in the north-northwest. A little farther north than here it doesn't set at all, but circles around through due north.

    So in summer in the northern hemisphere it rises and sets north of due east/west.

    In the southern hemisphere it's just the same (only opposite) - in the summer it rises and sets south of due east/west.

    The calculator is correct.

  4. #34

    Join Date
    Apr 2004
    Location
    SF Bay Area, California, USA
    Posts
    331

    Re: New utility by Jeff Conrad: Sun/Moon calculator

    To an observer in space, the apparent motions of the Sun and Moon are quite simple. Governed primarily by Earth's rotation, the paths of the Sun and Moon are quite simple: parallels determined by the Sun's or Moon's declination (angle with the plane of the celestial and Earth's equator). To an observer at a particular point on Earth, the apparent paths are a bit more complicated.

    The attached file illustrates what's happening. The figures are for the northern hemisphere; the situation in the south is just the reverse, as Ole described (imagine everything mirrored about the vertical line through the zenith). The purple axis through P is the north-south axis of the celestial sphere, as well as the axis of Earth's rotation. The paths of the Sun and Moon are circles, as shown in yellow.

    To an earthbound observer, whose horizon is the plane NESW, the paths appear anything but circular, which is why an azimuth/altitude table seems so complex.

    The figures indicate the general characteristics of the Sun's path, for any geographic latitude. Ar and As are the azimuths of rise and set. The descriptions that follow are for the northern hemisphere.

    • Summer solstice: The Sun rises and sets north of east and west, and reaches its greatest maximum altitude at due south.
    • Spring/Fall equinoxes: The sun rises and sets due east and west; day length is approximately 12 hours, for all latitudes.
    • Winter solstice: The Sun rises and sets south of east and west, and reaches its least maximum altitude at due south.

  5. #35

    Re: New utility by Jeff Conrad: Sun/Moon calculator

    Great program, Jeff - thank you.

    Farzad

  6. #36

    Re: New utility by Jeff Conrad: Sun/Moon calculator

    Jeff, I'm trying to use your utility to display information about sun/moon rise, sun/moon culm, sun/moon set in a weather "skin" that I wrote for a free software called Rainmeter. I'm trying to use your utility because it gives both sun and moon data in one single table, instead of having to access two times the US Naval Observatory site, which can sometimes be tricky (possibly because it's "busy" processing worldwide requests?).

    The thing is, I have a problem... The Rainmeter program that's displaying my "skin" is using a plugin called WebParser, which is essentially parsing the webpage information, making the grabbing of individual elements from the webpage possible through RegEx (regular expression processing). But this plugin requires that I use URL parameters to grab the information needed, so I use something like

    http://www.largeformatphotography.in...d&calc=display

    to do the job. The problem is that when executing this, the browser -Firefox 37.0- (and most likely the WebParser plugin itself) will open up two webpages : one with which looks exactly like http://www.largeformatphotography.info/sunmooncalc/ with the text boxes filled and another one, which is actually the page I need - the equivalent of pushing the "Display" button from the first page. Now this is unlike any other site that I tried and it makes parsing the information needed impossible, as the plugin grabs - quite logically - only the first webpage (the one which doesn't display the results, only the filled form).

    So, the bottom line is that I want to use your utility, but I can't. Can't you make the Sun/Moon Calculator URL Parameter method only display the results page, so that my skin would be able to grab the correct information? Plus, I've also noticed another undesirable behaviour : when having multiple tabs open with your forms/tables, pushing the "Display" button in one tab would generate no effect in that page (or wouldn't open a new tab with the desired table), but it will display what I need in an "already used" tab, replacing the previous table there. I'm sure this is not the expected behaviour...

    Thank you for your utility and great job, by the way! If only those 2 issues above could be corrected...

  7. #37

    Join Date
    Aug 2013
    Location
    Brazil - Rio Grande do Sul
    Posts
    811

    Re: New utility by Jeff Conrad: Sun/Moon calculator

    Hi Yincognito,

    Even not knowing your application at deeper level, it's obvious that the app is parsing the special character "?" as a break or other command. Can you type the hole string in quotes or commas to test if what's enclosed in is correctly parsed?

    Renato - who has spent many years trying to nail regex expressions at the shell unix terminal, sometimes without much success,

  8. #38

    Re: New utility by Jeff Conrad: Sun/Moon calculator

    First of all, thank you for your answer, Renato.
    It's not a "?" problem, I'm 100% sure of it. In fact, I didn't yet write the RegEx string, as it wasn't necessary. Rainmeter (the actual application that my "skin" is built upon) has a little tool to check whether the RegEx string correctly parses the info from a webpage. It's quite intuitive, simple and effective. You can download it here and check for yourself. I don't know if it works without the main application (Rainmeter), but it should.

    Anyway, you'll see that after pasting the sunmooncalc link in the "Enter web site URL or browse for HTML / text file" textbox from RainRegExp utility and hit "Connect", you'll get in the big textbox below the page source of the actual form webpage and not the results (table) webpage. You can further check if it's really true by chosing to view "Page Source" in your browser. The data from the form webpage is the same as the one that RainRegExp (and implicitly the WebParser plugin from Rainmeter) is receiving. I think this has to do with the fact that the results webpage is opened up as a "popup". But basically, the thing is...the "first" webpage (the one with the form) shouldn't be opened in the first place, only the results page.

    As for the "?" character, since working at my skin for Rainmeter I've become quite fond of RegEx and I dare to say, quite good at it I'm not a rookie anymore in this and there's no way I could incorrectly write a "?" without escaping it. Plus, one very important aspect of the Rainmeter WebParser syntax is that the URL of the site is separated from the RegEx string (e.g. they belong to different lines of code or "options" as they are called in Rainmeter).

    A simple example of Rainmeter code:

    [NASASunTimes]
    Measure=Plugin
    Plugin=WebParser
    Url="http://aa.usno.navy.mil/cgi-bin/aa_mrst2.pl?form=2&ID=AA&year=2015&month=5&day=10&reps=5&body=10&place=&lon_sign=1&lon_deg=26&lon_min=23&lon_sec=59&lat_sign=1&lat_deg=70&lat_min=57&lat_sec=35&height=&tz=3&tz_sign=1"
    RegExp="(?siU).*<pre>.*\n(\d.*)\n(\d.*)\n(\d.*)\n(\d.*)\n(\d.*)\n.*</pre>.*"
    UpdateRate=3600

    As you can see, the Url and RegExp strings are different things, so a "?" in the URL can't affect or be incorrectly interpreted by the RegEx, which takes an entirely different string as a parameter. You can test this in the RainRegExp utility too - just paste the Url string rom the code below into the "Html to Parse" textbox and the RegExp string into the "Your RegExp" textbox (but do not include the quotes). You'll see the webpage is parsed correctly, resulting in 5 strings, each one describing its own date.

    The issue is...I'm not even close to making a RegEx for Jeff's utility, as that would attemp to parse the form webpage, and not the results (table) one.

  9. #39

    Join Date
    Apr 2004
    Location
    SF Bay Area, California, USA
    Posts
    331

    Re: New utility by Jeff Conrad: Sun/Moon calculator

    Yincognyto,

    I see what you mean. To be honest, the URL parameter interface was an add on, done late late in the process at the request of one user. The implementation strove to minimize the changes to the code. One consequence of this is that indeed two pages are returned. This was by design; the user who asked for the URL parameter interface wanted to use the Rise/Set Criteria feature to find dates on which the Sun or Moon position aligned with a terrestrial feature. The Az/Alt limits were set from a tool similar to the Sun/Moon Calculator Az/Alt Tool, and essentially derived from tolerances on the azimuth and altitude to the feature as determined by geodetic calculations. For someone who always wants a “bulls-eye” alignment, this works just fine. But for many—including me—other aesthetic considerations often come into play. Accordingly, I thought it useful to bring up the main form so that a user could open the Rise/Set Criteria form to make adjustments to the formulaic limits if necessary.

    Thinking about it, it does seem that a URL query usually returns only the results (as with the USNO). But the URL parameter interface has been available for three years now, and I’m reluctant to make changes that could break apps that depend on the current behavior. Perhaps I can simply add a parameter to suppress display of the main form—but I need to see just how much work is entailed. Long ago, the output overwrote the main form—but in doing so created some problems, the exact nature of which I cannot recall.

    Arguably off topic, but perhaps nonetheless relevant: if you have anything that runs iOS 3.0, you should take a look at Stephen Trainor’s The Photographer’s Ephemeris. It’s a graphically oriented app that now implements much of what the Sun/Moon Calculator does, including date searches. And the implementation of elevation profiles is by far the most innovative that I have seen.

    One thing TPE does not provide is tabular display of Rise/Set times and Sun and Moon positions, which you seem to be seeking and which I still sometimes prefer—but I may just be getting long in the tooth.

    Sorry for the delay in responding. It’s been a long time since the last post to this thread, and I apparently got unsubscribed when the forum software was changed a while back

  10. #40

    Re: New utility by Jeff Conrad: Sun/Moon calculator

    Thank you for your reply, Jeff. I also agree that a new parameter for displaying only the results page is the best choice, that is if you decide it's easy/not time consuming enough and it doesn't break the already existing behaviour.

    I already looked over Stephen Trainor’s The Photographer’s Ephemeris (and most of the other sun/moon rise/set+twilight sites over the internet) and you're right, I absolutely need a site that uses parameters and not exclusively Javascript - not necessarily a tabular results page, but a page accesible by using GET parameters. The WebParser plugin cannot manipulate Javascript code by itself, it simply parses the webpage source (and in the case of Javascript only sites, that consists of only the JS functions, not the actual result).

    What I'm actually doing in my Rainmeter "skin" is:
    - get the weather from a weather.com web query
    - use the <lat>, <long>, <zone> and <dayf>/<lsup> sections from the above resulting xml to pass parameters to another site which will get sun/moon rise/set/culmination for the 5 days forecasted interval
    - use the <lat>, <long>, <zone> and <cc>/<lsup> sections from the above resulting xml to pass parameters to another site which will get sun/moon rise/set/culmination/twilights for the current conditon day

    For the last action, I need all 3 twilight types : begin/end astronomical twilight, begin/end nautical twilight and begin/end civil twilight in my skin, as I wrote a quite interesting algorithm for lightning up the sky .png image in my skin to simulate the exact appearance of the sky (and obviously the weather "icon") at every moment of the day. I do that by applying an alpha brightness to the default sky image, so all 3 twilight types are essential, because the sky will get from "night light" to lighten up very slow during the astronomical to nautical twilight, then lighten up using a similar rate during the nautical to civil twilight and then using an extremely fast rate to lighten up during the civil twilight to sunrise. After that, the sky will continue to lighten up slowly until midday, before performing the reversed order process for the second part of the day.

    So you see, I'm trying to do an ambitious thing here, lol, but I need a site which will provide me with the required data, for the required interval, while using parameters. That's a lot of conditions to be met, but the result will be equally beautiful. Add that to using a very realistic sun .png image and NASA moon processed .png images for the respective age of the moon in days and you'll get the exact representation of what's outside (weather, sun, sky, moon appearance) for any given moment (I only need the "now" aka current condition moment and the day/night moments for the 5 days forecasted).

    Oh, and I almost forgot...I'm trying all the above while having to access as few webpages as possible. Three would be ideal : one for the weather, one for the current condition sun/moon data and one for the forecasted days sun/moon data.

    For example, I found this which will almost provide me with what I need, but it has some inconvenients : the result page is a little difficult to parse, as the lines and the table itself are very "dynamic", plus I'm stuck with the data for a whole month while I need only 1 day + 5days data only. The latter would also force me to query that site more than once, if the starting date of the forecasted days is at the end of the month, as I would need to get the next month data as well, for the remainder days...

    So you see, Jeff, I'm in a big dilema

Similar Threads

  1. Is there any real utility to ULF?
    By Tom Hieb in forum Cameras - ULF (Ultra Large Format) and Accessories
    Replies: 271
    Last Post: 21-Sep-2023, 03:01
  2. New articles by Jeff Conrad on DoF
    By QT Luong in forum Feedback
    Replies: 27
    Last Post: 5-Jan-2022, 06:56
  3. New article by Jeff Conrad: Introduction to DOF
    By QT Luong in forum Feedback
    Replies: 10
    Last Post: 7-Mar-2005, 23:37
  4. Steve Grimes'"Utility Sinar Lens Boards"
    By Robert J. Triffin in forum Lenses & Lens Accessories
    Replies: 0
    Last Post: 9-Nov-2001, 08:46
  5. Arca Brainbox utility?
    By Steve Singleton in forum Gear
    Replies: 17
    Last Post: 27-Apr-2000, 01:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •