[Tutor] lists, arrays and saving data

Corey Richardson kb1pkl at aim.com
Sun Nov 21 19:34:57 CET 2010



On 11/21/2010 8:12 AM, Chris Begert wrote:
> Hi Gurus
>
> I just wrote my first little python program; so yes I'm very new to all this.
>
> The goal in the end is to have a program that shows how the sun moves  from the point of view of a given location (i.e. solar paths added to some sort of stereographic diagram).
>
> My very first program calculates the height (altitude) and direction of the sun (Azimuth) at a specific location during a specific time.
>
> So here's my question (I'm sure its obvious for most of you):
>
> How do I store a years worth of data of angles in an array / list / whatever is most useful when using Python?
>
> <snip>

Well now. You can store altitude and AZ in a tuple, and append that 
tuple to a list called, for example, data. data.append((altitude, AZ)), 
where data = list(). You will probably want to wrap all that calculation 
into a function that takes 6 arguments: longitude, latitude, month, day, 
hour, and minutes, instead of taking that input by hand. That way you 
can put everything into a nice for loop (in theory).


More information about the Tutor mailing list