[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pysolar-discuss] Strange azimuth values


When I apply the proposed method I get these results,

[2015-05-10 00:00:00+00:25] Altitude: -22.817917957170042 Azimuth:
0.9195853796406368
[2015-05-10 01:00:00+00:25] Altitude: -21.35437669913535 Azimuth:
16.282490410169657
[2015-05-10 02:00:00+00:25] Altitude: -17.460113361911073 Azimuth:
30.88264446553194
[2015-05-10 03:00:00+00:25] Altitude: -11.530293822218377 Azimuth:
44.334853539473784
[2015-05-10 04:00:00+00:25] Altitude: -4.041985922217601 Azimuth:
56.64229429837951
[2015-05-10 05:00:00+00:25] Altitude: 4.721075310609919 Azimuth:
68.08448558243651
[2015-05-10 06:00:00+00:25] Altitude: 13.916416678430616 Azimuth:
79.1019578849806
[2015-05-10 07:00:00+00:25] Altitude: 23.540263468364685 Azimuth:
90.25884449955726
[2015-05-10 08:00:00+00:25] Altitude: 33.162952138663265 Azimuth:
102.29127881328759
[2015-05-10 09:00:00+00:25] Altitude: 42.311459924908625 Azimuth:
116.22795411782772
[2015-05-10 10:00:00+00:25] Altitude: 50.279286820496274 Azimuth:
133.49311577994877
[2015-05-10 11:00:00+00:25] Altitude: 55.94436234658116 Azimuth:
155.49523632286264
[2015-05-10 12:00:00+00:25] Altitude: 57.89747249155467 Azimuth:
181.6026287381771
[2015-05-10 13:00:00+00:25] Altitude: 55.45948436540424 Azimuth:
207.40278382169132
[2015-05-10 14:00:00+00:25] Altitude: 49.46294168127422 Azimuth:
228.8272461199938
[2015-05-10 15:00:00+00:25] Altitude: 41.31880137304067 Azimuth:
245.63086306581897
[2015-05-10 16:00:00+00:25] Altitude: 32.09659468953159 Azimuth:
259.28835550065156
[2015-05-10 17:00:00+00:25] Altitude: 22.46665426651643 Azimuth:
271.18090530087704
[2015-05-10 18:00:00+00:25] Altitude: 12.887187896956561 Azimuth:
282.29565250233105
[2015-05-10 19:00:00+00:25] Altitude: 3.8032148272317357 Azimuth:
293.34291810798067
[2015-05-10 20:00:00+00:25] Altitude: -4.854352153303335 Azimuth:
304.8696257443884
[2015-05-10 21:00:00+00:25] Altitude: -12.152382809733522 Azimuth:
317.2976741424302
[2015-05-10 22:00:00+00:25] Altitude: -17.83265833925366 Azimuth:
330.87639859009437

On Sun, May 10, 2015 at 11:28 PM, Jay Doscher <jay@xxxxxxxxxxxxx> wrote:

> I found the same issue, and managed to successfully offset it in my python
> code.  A disclaimer though- this works for me in the southwest US, and may
> be different elsewhere.
>
> def getsolarheading():
>         Azimuth = Pysolar.GetAzimuth(maplat, maplon,
> datetime.datetime.utcnow())
>         if Azimuth < 0:
>                 if (Azimuth >= -180):
>                         solarheading = ((Azimuth * -1) + 180)
>                 if (Azimuth < -180):
>                         solarheading = ((Azimuth * -1) - 180)
>         if Azimuth >= 0:
>                 solarheading = Azimuth
>         return solarheading
>
> This code will translate the Azimuth from Pysolar into a compass heading.
> I'm not sure what to tell you about altitude.
>
> Cheers,
> Jay
>
> On Sun, May 10, 2015 at 2:05 PM, Frank Lazzarini <flazzarini@xxxxxxxxx>
> wrote:
>
>> Hi there,
>>
>> when I run the following simulation I get really odd azimuth values. Well
>> at least they seem odd, if I understood the documentation correctly they
>> from ~90 over 0 to -90 degrees. When I run a simulation of an entire day I
>> get really odd values for azimuth.
>>
>> from pysolar.solar import get_azimuth, get_altitude
>> from datetime import datetime
>> from pytz import timezone
>>
>>
>> latitude = 49.707524
>> longitude = 6.244362
>> year = 2015
>> month = 5
>> day = 10
>>
>>
>> def get_sun_position(latitude, longitude, time):
>>     alt = get_altitude(latitude, longitude, time)
>>     azi = get_azimuth(latitude, longitude, time)
>>     return alt, azi
>>
>> tzinfo = timezone('Europe/Luxembourg')
>> today = datetime.now(tz=tzinfo)
>>
>> for hour in range(0, 23):
>>     time = datetime(
>>         year,
>>         month,
>>         day,
>>         hour,
>>         0,
>>         tzinfo=tzinfo
>>     )
>>     alt, azi = get_sun_position(latitude, longitude, time)
>>     print("[{}] Altitude: {} Azimuth: {}".format(time, alt, azi))
>>
>>
>> Now when I run this I get the following values
>>
>>
>> [2015-05-10 00:00:00+00:25] Altitude: -22.817917957170042 Azimuth:
>> -180.91958537964064
>> [2015-05-10 01:00:00+00:25] Altitude: -21.35437669913535 Azimuth:
>> -196.28249041016966
>> [2015-05-10 02:00:00+00:25] Altitude: -17.460113361911073 Azimuth:
>> -210.88264446553194
>> [2015-05-10 03:00:00+00:25] Altitude: -11.530293822218377 Azimuth:
>> -224.33485353947378
>> [2015-05-10 04:00:00+00:25] Altitude: -4.041985922217601 Azimuth:
>> -236.6422942983795
>> [2015-05-10 05:00:00+00:25] Altitude: 4.721075310609919 Azimuth:
>> -248.0844855824365
>> [2015-05-10 06:00:00+00:25] Altitude: 13.916416678430616 Azimuth:
>> -259.1019578849806
>> [2015-05-10 07:00:00+00:25] Altitude: 23.540263468364685 Azimuth:
>> -270.25884449955726
>> [2015-05-10 08:00:00+00:25] Altitude: 33.162952138663265 Azimuth:
>> -282.2912788132876
>> [2015-05-10 09:00:00+00:25] Altitude: 42.311459924908625 Azimuth:
>> -296.2279541178277
>> [2015-05-10 10:00:00+00:25] Altitude: 50.279286820496274 Azimuth:
>> -313.49311577994877
>> [2015-05-10 11:00:00+00:25] Altitude: 55.94436234658116 Azimuth:
>> -335.49523632286264
>> [2015-05-10 12:00:00+00:25] Altitude: 57.89747249155467 Azimuth:
>> -1.6026287381770885
>> [2015-05-10 13:00:00+00:25] Altitude: 55.45948436540424 Azimuth:
>> -27.402783821691315
>> [2015-05-10 14:00:00+00:25] Altitude: 49.46294168127422 Azimuth:
>> -48.82724611999379
>> [2015-05-10 15:00:00+00:25] Altitude: 41.31880137304067 Azimuth:
>> -65.63086306581897
>> [2015-05-10 16:00:00+00:25] Altitude: 32.09659468953159 Azimuth:
>> -79.28835550065156
>> [2015-05-10 17:00:00+00:25] Altitude: 22.46665426651643 Azimuth:
>> -91.18090530087704
>> [2015-05-10 18:00:00+00:25] Altitude: 12.887187896956561 Azimuth:
>> -102.29565250233105
>> [2015-05-10 19:00:00+00:25] Altitude: 3.8032148272317357 Azimuth:
>> -113.34291810798067
>> [2015-05-10 20:00:00+00:25] Altitude: -4.854352153303335 Azimuth:
>> -124.86962574438837
>> [2015-05-10 21:00:00+00:25] Altitude: -12.152382809733522 Azimuth:
>> -137.2976741424302
>> [2015-05-10 22:00:00+00:25] Altitude: -17.83265833925366 Azimuth:
>> -150.87639859009437
>>
>>
>>
>> Any ideas?
>>
>> --
>>
>> *Frank Lazzarini*
>> *Email:* flazzarini@xxxxxxxxx  *Phone:* +352 621 314 430
>> *Blog:*   http://www.gefoo.org   *LinkedIn:*
>> http://www.linkedin.com/pub/frank-lazzarini/1a/a30/112
>>
>>
>


-- 

*Frank Lazzarini*
*Email:* flazzarini@xxxxxxxxx  *Phone:* +352 621 314 430
*Blog:*   http://www.gefoo.org   *LinkedIn:*
http://www.linkedin.com/pub/frank-lazzarini/1a/a30/112

Follow-Ups:
Re: [pysolar-discuss] Strange azimuth valuesJay Doscher <jay@xxxxxxxxxxxxx>
References:
[pysolar-discuss] Strange azimuth valuesFrank Lazzarini <flazzarini@xxxxxxxxx>
Re: [pysolar-discuss] Strange azimuth valuesJay Doscher <jay@xxxxxxxxxxxxx>