ladybug-tools / ladybug-legacy

:beetle: Ladybug is an environmental plugin for Grasshopper.
http://ladybug.tools
Other
194 stars 82 forks source link

Add alternate NOAA as alternate sun position calculation #73

Closed mostaphaRoudsari closed 10 years ago

mostaphaRoudsari commented 10 years ago

This discussion came up while ago: http://www.grasshopper3d.com/group/ladybug/forum/topics/sun-path-from-ecotect-vs-ladybug

and it keeps coming up over and over. Recently I had a discussion with Rob on the same issue and he has been so passionate to get this discrepancy solved. He has also found cases that discrepancy is more than a degree. Here are two thing that I want to do.

  1. Double check the results from sunpath with Radiance command line again and make sure the results are identical
  2. Add NOAA as an alternate method of calculation for users who prefer this method.
rnarracci commented 10 years ago

M,

Re: #2, don't you mean USNO?

USNO http://aa.usno.navy.mil/data/docs/AltAz.php

NOAA http://www.esrl.noaa.gov/gmd/grad/solcalc/azel.html

Same thing I suppose? I like the USNO site because it outputs a full chart at increments you choose. (for the image below, I chose 60 minute increments)

usno vs noaa

R

chriswmackey commented 10 years ago

Mostapha,

I forgot to tell you. Trygve has a class of functions for really precisely pin-pointing solar position that are much more accurate than the ones that you have now. His functions have a "year" input and they are apparently accurate for the next 3,000 years or so. I'm not saying that we need a year input on our components but that is just to give you a sense of how accurate they are.

Since I got permission from Trygve, I was going to move all of his functions into Ladybug_Ladybug in order to create a sun color component but, seeing that I am falling behind on this. I will post a GH definition that has Trygve's class in it here:

https://www.dropbox.com/s/72fo9f6werj1bto/sun%20color-base.gh

Let me know if you end up using some of his functions on the sunpath component. I think Trygve cites sources in his code but, in the event that he forgot, do not fret to shoot the both of us an email.

mostaphaRoudsari commented 10 years ago

@chriswmackey Nice! it is all coming together. It is a good idea to replace them with a more accurate algorithm.

@rnarracci do you mind to give the component a try and let me know if the result matches with NOAA/USNO before we replace it with the current algorithms? In either cases we can create an output similar to your example.

@twastvedt thanks for sharing.

rnarracci commented 10 years ago

Hi M,

The first time we corresponded on this subject was June 2nd (screenshots below) and since then I haven't downloaded any updated components from you. It was my observation then that the Ladybug_SunPath component was generating sunAltitudes and sunAzimuths that didn't match US Naval Observatory calculations (a similar Helitrope component did match USNO).

I'm new to your GitHub page so I'll ask maybe a dumb question... have you updated this component since the March26th version? If so can I get it and take it for a test drive?

lb usno lb 2

mostaphaRoudsari commented 10 years ago

@rnarracci no I haven't. I was talking about the new file that @chriswmackey suggested here. I just checked and the results doesn't really match. I think I'm making a mistake. I will double check again later.

@twastvedt have you ever validated the results versus other resources? I get solarAzimuth of 4.131748 for 21 March 2014 for 16:00 for inputs similar to what you can see in the image.

sunposition

rnarracci commented 10 years ago

I'm sorry I can't help more...I don't know anything about programming.

twastvedt commented 10 years ago

I tested it enough in my time zone, comparing it to NOAA results, to use it in a project, but no, it hasn't been thoroughly vetted. I'll spend some time with it this weekend. I'm not sure why it's giving those results.

On Thu, Jul 24, 2014 at 8:15 AM, Robert Narracci notifications@github.com wrote:

I'm sorry I can't help more...I don't know anything about programming.

— Reply to this email directly or view it on GitHub https://github.com/mostaphaRoudsari/ladybug/issues/73#issuecomment-50000697 .

mostaphaRoudsari commented 10 years ago

No worries Rob. Thank you for pushing this.

Thanks @twastvedt. It is possible that I am making a mistake.

Nevertheless sky color feature is so magical. I really like to know more about it and potential uses of it and let's add it as a standard component as Chris suggested while ago, (and yes I should read that email!)

chriswmackey commented 10 years ago

@rnarracci and @mostaphaRoudsari. I am pretty sure that I know why you get that result out of @twastvedt 's component. If I had to guess, I would say that it is giving results in radians instead of degrees.

azimuth = 4.131748 radians = 236.731722 degrees zenith = 0.706673 radians = 40.4893804 degrees altitude = 90 - 40.4893804 = 49.5106196 degrees

So I would say that @twastvedt 's component is pretty much in dead-on in-sync with the USNO database. Do we agree that we should move the sunpath over to these functions?

rnarracci commented 10 years ago

Hi Chris

I'm out if my hometown for a couple of days sans laptop but when I get home ill post a solution for you to look at. I was seeing an issue with the Ladybug_SunPath component released in March, not twastvedt's component.

mostaphaRoudsari commented 10 years ago

@chriswmackey Thanks. I should have guessed that. :+1: Great! Then lets replace the current class with this one.

chriswmackey commented 10 years ago

IT IS DONE. fixed altitude-azimuth

@twastvedt, I also pasted your class into LB_LB. I'll see if I can bang out a quick LB_sky color component tonight based off of what you have.

mostaphaRoudsari commented 10 years ago

Great job @chriswmackey. Let's apply the sky color after we talk to @twastvedt this week. If he is updating the code then we may want to wait for the newer version of his work.

chriswmackey commented 10 years ago

I wish I had seen your comment sooner, @mostaphaRoudsari as I just committed a sky color component using Trygve's functions.

I will say that, from what I gathered from meeting with @twastvedt a couple of weeks ago, most of the things that Trygve imagined updating were with some of the functions around evening and early morning. The other functions (like the sun position calculation) were pretty solid and, so long as we are using the component to inform intuition about sky qualities and not taking the exact color values as fact for the time being, we are in the clear. Also, I know that @twastvedt is pretty busy at the moment and I think that he mentioned most further work on the component will not be done until he hits the thesis trail in September. Correct me if I am wrong, Trygve.

Lastly, I will say that I made the new component to the specifications that @twastvedt and I agreed on in our meeting and, Trygve, if I am forgetting anything, please let me know. You can find an example file here: https://www.dropbox.com/s/dhtu1kgjky50jtf/SkyColor%20Component.gh

mostaphaRoudsari commented 10 years ago

No worries. This is beautiful! My only concern was duplication of work which I recognize is not the case here. Thank you both.

I wish there was a way to apply transparency to colored mesh which as far as I know is not possible in Grasshopper.