Sunday, December 20, 2009

Weather is not climate...

…but I do understand if people in Northeastern USA sort of doubt global warming right now. Yikes, those are some snowstorms.

Here’s a linked satellite image from USA Today :

Snowstorms

Snowstorms

Meanwhile, everyone keeps saying that the “Copenhagen accord” is a big failure, and that we are now screwed, people are going to die, etc. I think not. I think actually, it was a big success. Because now we have at least 6 more months to raise awareness that the science is in fact NOT settled. You may stare at this code-snippet I have used to import the GHCNv2 gridded data into my SQL database. In anticipation.

public void LoadGridFile(string tableName, string filename, string dir) { Int32 north, south, west, east; String temp; FileStream fs = File.Open(Path.Combine(dir, filename), FileMode.Open); StreamReader sr = new StreamReader(fs); try { conn.Open(); for (int year = 1880; year <= 2009; year++) { Console.WriteLine("Reading year " + year.ToString()); for (int month = 1; month <= 12; month++) { sr.ReadLine(); // Year and month for (int ylat = 90; ylat > -90; ylat -= 5) { string _180_120 = sr.ReadLine(); // -180 to -120, 180W-120W string _120_60 = sr.ReadLine(); string _60_0 = sr.ReadLine(); string _0_60 = sr.ReadLine(); string _60_120 = sr.ReadLine(); string _120_180 = sr.ReadLine(); // 120 to 180, 120E-180E for (int i = 0; i < 5; i++) { Int32 stringOffset = i * 6; Int32 latOffset = i * 5; north = ylat; south = north - 5; /* 1st line */ west = -180 + latOffset; east = west + 5; temp = _180_120.Substring(stringOffset, 6); if (temp == "-32768") temp = "NULL"; RunInsertQuery(tableName, new List() { north.ToString(), south.ToString(), east.ToString(), west.ToString(), year.ToString(), month.ToString(), temp }); /* 2nd line */ west = -120 + latOffset; east = west + 5; temp = _120_60.Substring(stringOffset, 6); if (temp == "-32768") temp = "NULL"; RunInsertQuery(tableName, new List() { north.ToString(), south.ToString(), east.ToString(), west.ToString(), year.ToString(), month.ToString(), temp }); /* 3rd line */ west = -60 + latOffset; east = west + 5; temp = _60_0.Substring(stringOffset, 6); if (temp == "-32768") temp = "NULL"; RunInsertQuery(tableName, new List() { north.ToString(), south.ToString(), east.ToString(), west.ToString(), year.ToString(), month.ToString(), temp }); /* 4th line */ west = 0 + latOffset; east = west + 5; temp = _0_60.Substring(stringOffset, 6); if (temp == "-32768") temp = "NULL"; RunInsertQuery(tableName, new List() { north.ToString(), south.ToString(), east.ToString(), west.ToString(), year.ToString(), month.ToString(), temp }); /* 5th line */ west = 60 + latOffset; east = west + 5; temp = _60_120.Substring(stringOffset, 6); if (temp == "-32768") temp = "NULL"; RunInsertQuery(tableName, new List() { north.ToString(), south.ToString(), east.ToString(), west.ToString(), year.ToString(), month.ToString(), temp }); /* 6th line */ west = 120 + latOffset; east = west + 5; temp = _120_180.Substring(stringOffset, 6); if (temp == "-32768") temp = "NULL"; RunInsertQuery(tableName, new List() { north.ToString(), south.ToString(), east.ToString(), west.ToString(), year.ToString(), month.ToString(), temp }); } } } } } finally { conn.Close(); } }

DN SvD

[Via http://savecapitalism.wordpress.com]

No comments:

Post a Comment