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

[python #SXM-109553]: latest obs to CSV?



Hi,

No worries! What's the actual error message you receive?

Ryan

> Hi again,
> 
> The error that I was receiving yesterday seems to have resolved somehow.  I 
> apologize!
> 
> However, I am still having a slight issue with the next step after that.  I 
> am trying to write the Lat, Lon, Temp, Station ID to a CSV file and I keep 
> getting an error.
> 
> I'm essentially trying to take the data from the surface temp map and just 
> create a list of the data as well.
> 
> [(42.36056, -71.01056, 41.0, 'KBOS'),
> (42.58361, -70.91639, 39.2, 'KBVY'),
> (42.7126, -71.12553, 39.2, 'KLWM'),
> (42.56201, -70.84952, 39.99, 'C0169'),
> (42.4392, -71.05142, 39.0, 'C0210'),
> (42.5387, -70.9802, 39.99, 'AR100'),
> (42.46517, -70.96583, 39.0, 'AR572'),
> (42.62576, -71.33691, 37.99, 'C3660'),
> (42.7252, -71.2013, 37.0, 'C3868'),
> (42.80633, -70.89967, 37.0, 'C6151'),
> (42.3603, -71.08936, 39.0, 'C6612'),
> (42.54292, -71.09006, 37.0, 'C9683'),
> (42.67935, -70.658, 36.0, 'AT034'),
> (42.46867, -70.90883, 41.0, 'D2257'),
> (42.67467, -70.97133, 37.0, 'D2806'),
> (42.37783, -70.97183, 39.99, 'D3706'),
> (42.63584, -70.59736, 45.0, 'AT375'),
> (42.55912, -70.87397, 14.0, 'D4800'),
> (42.58872, -70.87133, 39.0, 'D5181'),
> (42.69956, -71.01931, 36.0, 'D5391'),
> (42.82407, -70.88762, 39.0, 'D6723'),
> (42.37333, -71.15017, 39.99, 'D7355'),
> (42.343, -71.06683, 39.0, 'E2727'),
> (42.72134, -71.1482, 37.0, 'D7873'),
> (42.45233, -71.06317, 37.0, 'E4331'),
> (42.5075, -71.15467, 37.0, 'E4960'),
> (42.63217, -70.96867, 37.99, 'E5193'),
> (42.49567, -71.19767, 37.99, 'E5913'),
> (42.40383, -71.15533, 37.99, 'E6480'),
> (42.63683, -70.57533, 42.01, 'AV086'),
> (42.47367, -70.94617, 42.01, 'AV154'),
> (42.48517, -71.24683, 36.0, 'E9012'),
> (42.46217, -70.9285, 42.01, 'E9578'),
> (42.44717, -71.13083, 39.99, 'E9991'),
> (42.68617, -70.84583, 41.0, 'E7580'),
> (42.2825, -71.13967, 41.0, 'F0642'),
> (42.55949, -70.93655, 41.0, 'F1086'),
> (42.86017, -70.919, 39.0, 'F3197')]
> 
> And then here is the code that I've attempted to get this to CSV:
> 
> with open("C:\\Users\\Public\\Documents\\outfile.csv", 'wb') as outcsv:
> writer = csv.writer(outcsv,delimiter=',')
> writer.writerow(["lat", "long", "temp", "station"])
> for i in data:
> writer.writerow(i)
> outcsv.close()
> output_file.close()


Ticket Details
===================
Ticket ID: SXM-109553
Department: Support Python
Priority: Low
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.