Yesterday I attempted to watch the A’s Opening Day game against the Mariners in the Oakland Coliseum. Unfortunately, it turns out the entire state of Alaska is within the blackout region for all Seattle Mariners games, regardless of where the Mariners are playing.
The A’s lost the game, so maybe I’m not too disappointed I didn’t see it, but for curiousity, let’s extend Major League Baseball’s Alaska blackout “logic” to the rest of the country and see what that looks like.
First, load in the locations of all Major League stadiums into a PostGIS database. There are a variety of sources for this on the Internet, but many are missing the more recent stadiums. I downloaded one and updated those that weren’t correct using information on Wikipedia.
CREATE TABLE stadiums ( division text, opened integer, longitude numeric, latitude numeric, class text, team text, stadium text, league text, capacity integer ); COPY stadiums FROM 'stadium_data.csv' CSV HEADER;
Turn the latitude and longitudes into geographic objects:
SELECT addgeometrycolumn('stadiums', 'geom_wgs84', 4326, 'POINT', 2); CREATE SEQUENCE stadium_id_seq; ALTER TABLE stadiums ADD COLUMN id integer default (nextval('stadium_id_seq')); UPDATE stadiums SET geom_wgs84 = ST_SetSRID( ST_MakePoint(longitude, latitude), 4326 );
Now load in a states polygon layer (which came from: http://www.arcgis.com/home/item.html?id=f7f805eb65eb4ab787a0a3e1116ca7e5):
$ shp2pgsql -s 4269 states.shp | psql -d stadiums
Calculate how far the farthest location in Alaska is to Safeco Field:
SELECT ST_MaxDistance(safeco, alaska) / 1609.344 AS miles FROM ( SELECT ST_Transform(geom_wgs84, 3338) AS safeco FROM stadiums WHERE stadium ~* 'safeco' ) AS foo, ( SELECT ST_Transform(geom, 3338) AS alaska FROM states WHERE state_name ~* 'alaska' ) AS bar; miles ------------------ 2467.67499410842
Yep. Folks in Alaska are supposed to travel 2,468 miles (3,971,338 meters, to be exact) in order to attend a game at Safeco Field (or farther if they’re playing elsewhere because the blackout rules aren’t just for home games anymore).
Now we add a 2,468 mile buffer around each of the 30 Major League stadiums to see what the blackout rules would look like if the rule for Alaska was applied everywhere:
SELECT addgeometrycolumn( 'stadiums', 'ak_rules_buffer', 3338, 'POLYGON', 2); UPDATE stadiums SET ak_rules_buffer = ST_Buffer(ST_Transform(geom_wgs84, 3338), 3971338);
Here's a map showing what these buffers look like:
Or, shown another way, here’s the number of teams that would be blacked out for everyone in each state. Keep in mind that there are 30 teams in Major League Baseball so the states on the top of the list shouldn’t be able to watch any team if Alaska rules were applied evenly to the country:
|Blacked out teams||States|
|30||Alabama, Arkansas, Colorado, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana, Michigan, Minnesota, Mississippi, Missouri, Nebraska, New Mexico, North Dakota, Ohio, Oklahoma, South Dakota, Tennessee, Texas, Utah, Wisconsin, Wyoming|
|29||Idaho, Montana, Arizona|
|28||District of Columbia, West Virginia|
|27||Georgia, South Carolina|
|25||Pennsylvania, Florida, Vermont|
|24||Rhode Island, New Hampshire, Connecticut, Delaware, New Jersey, New York, North Carolina, Virginia, Maryland, Massachusetts|
|22||Oregon, Washington, California|
Based on this, Hawaii would be the place to live as they can actually watch all 30 teams! Except the blackout rules for Hawaii are even stupider than Alaska: they can’t watch any of the teams on the West Coast. Ouch!
This is stupid-crazy. It seems to me that a more appropriate rule might be buffers that represent a two hour drive, or whatever distance is considered “reasonable” for traveling to attend a game. When I lived in Davis California we drove to the Bay Area several times a season to watch the A’s or Giants play, and that’s about the farthest I’d expect someone to go in order to see a three hour baseball game.
This makes a much more reasonable map:
I’m sure there are other issues going on here, such as cable television deals and other sources of revenue that MLB is trying to protect. But for the fans, those who ultimately pay for this game, the current situation is idiotic. I don’t have access to cable television (and even if I did, I won’t buy it until it’s possible to pick and choose which stations I want to pay for), and I’m more than 2,000 miles from the nearest ballpark. My only avenue for enjoying the game is to pay MLB $130 for a MLB.TV subscription. Which I happily do. Unfortunately, this year I can’t watch my teams whenever they happen to play the Mariners.
Over the past couple days in Fairbanks, there has been a strong flow of warm, moist air from the Pacific which culminated in a record (for January 14th) 0.22 inches of precipitation, most of which fell as rain. Nasty. Similar events happened in 2011 and in November 2010, which everyone will remember for the inch or more of ice that glazed the roads for the rest of the winter that year.
The question people always ask after a series of events like this is whether this is a new weather pattern (let’s hope not!) and whether it may be the result of global climate change (which I probably can’t answer).
To look at this, I examined the historical record for Fairbanks, searching for dates that met the following criteria:
- At least six inches of snow on the ground
- During the winter months (October through February)
- Daily high temperature above freezing
- Precipitation falling as rain
The last criteria isn’t part of the historical record, but we can guess the amount of rain by comparing the amount of snow (measured each day on a snow board that is cleared after measurement) with the amount of liquid precipitation gathered in a tube and melted, if necessary. In my experience, the ratio of snow to liquid precipitation is almost always less than 10 to 1 (meaning that 10 inches of snow melts down to less than an inch of liquid), so I’m looking for dates where the precipitation amount is greater than 10 times the snowfall for that date. I’m also estimating the amount of rain by subtracting (snow × 10) from the precipitation total.
Here’s the query:
SELECT dte, tmin_f, tmax_f, prcp_in, snow_in, rain_in, row_number() OVER (ORDER BY rain_in desc) AS rank FROM ( SELECT to_char(dte, 'YYYY-MM') AS dte, round(avg(tmin_f), 1) AS tmin_f, round(avg(tmax_f), 1) AS tmax_f, sum(prcp_in) AS prcp_in, sum(snow_in) AS snow_in, sum(rain_in) AS rain_in FROM ( SELECT dte, tmin_f, tmax_f, prcp_in, snow_in, snwd_in, round(prcp_in - (snow_in / 10.0), 2) AS rain_in FROM get_ghcnd('Fairbanks Intl Ap') WHERE extract(month from dte) IN (10, 11, 12, 1, 2) AND snwd_in > 6 AND tmax_f > 32 AND prcp_in * 10 > snow_in ORDER BY dte ) AS foo GROUP BY to_char(dte, 'YYYY-MM') ) AS bar ORDER BY dte;
And the results, ordered by the year and month of the event. None of the winter rain events stretched across a month boundary, so it was convenient to aggregate them this way (although 1937 is problematic as I mention below).
|Date||Min Temp (°F)||Max Temp (°F)||Precip (in)||Snow (in)||“Rain” (in)||Rank|
The 2010 event was had the third highest rainfall in the historical record; yesterday’s rain was the tenth highest. The January 1937 event is actually two events, one on the 10th and 11th and one on the 20th and 21st. If we split them up into two events, the 2010 rainfall amount is the second largest amount and the two January 1937 rainfalls come in third and tied for fifth, with November 1935 holding the record.
Grouping the events into decades, we get the following:
Here’s a visualization of the same data:
I don’t think there’s evidence that what we’ve seen in the last few years is exceptional in the historical record, but it does seem like the frequency of winter rainfall does come in cycles, with a peak in the 30s and 40s, and something of a decline in the 80s and 90s. That we’ve already had three events in this decade, in just over two years, seems like a bad sign to me. I wonder if there are larger scale climatological phenomena that could help to explain the pattern shown here?
Thinking a little more about my previous post on the cold winter we’ve been experiencing for the past three months, it would be easier to understand the analysis if I reported average temperature for the period, rather than a cumulative value. I also realized that if there were missing days in any of the record, that this would skew the results against those years with missing data. So here’s a better query and the results through December 23rd:
SELECT year, round(cum_f / n, 2) AS avg_tempf, rank() OVER (ORDER BY cum_f / n) AS rank FROM ( SELECT year, CASE WHEN year = 2012 THEN round(sum(tavg_f), 2) - 261.5 ELSE round(sum(tavg_f), 2) END AS cum_f, CASE WHEN year = 2012 THEN count(*) + 7 ELSE count(*) END AS n FROM ( SELECT extract(year from dte) AS year, extract(doy from dte) AS doy, (tmin_f + tmax_f) / 2.0 AS tavg_f FROM get_ghcnd('Fairbanks Intl Ap') ORDER BY year, doy ) AS foo WHERE doy between extract(doy from '2011-10-01'::date) AND extract(doy from '2012-12-23'::date) GROUP BY year ORDER BY year ) AS bar ORDER BY rank;
|Rank||Year||Average temp (°F)||Minimum temp (°F)||Maximum temp (°F)|
We’ve moved to third place on the list, with an average temperature over the period of less than zero Fahrenheit.
Here’s the same analysis for November and December (through the 23rd):
|Rank||Year||Average temp (°F)||Minimum temp (°F)||Maximum temp (°F)|
The Weather Service is forecasting some warmer weather starting today, so it’s likely we’ll begin to drop down the list, but it will be interesting to see where we wind up at the end of December.
Regardless, it’s been an exceptionally cold October, November and December in Fairbanks. We’re all just hanging on, hoping our houses, vehicles and other equipment continues to function until we get some warmer weather.
It seems like it’s been cold for almost the entire winter this year, with the exception of the few days last week when we got more than 16 inches of snow. Unfortunately, it’s been hard to enjoy it, with daily high temperatures typically well below -20°F.
Let’s see how this winter ranks among the early-season Fairbanks winters going back to 1904. To get an estimate of how cold the winter is, I’m adding together all the daily average temperatures (in degrees Celsius) for each day from October 1st through yesterday. Lower values for this sum indicate colder winters.
Here’s the SQL query. The CASE WHEN stuff is to include the recent data that isn’t in the database I was querying.
SELECT year, CASE WHEN year = 2012 THEN cum_deg - 112 ELSE cum_deg END AS cum_deg, rank() OVER ( ORDER BY CASE WHEN year = 2012 THEN cum_deg - 112 ELSE cum_deg END ) AS rank FROM ( SELECT year, round(sum(tavg_c) AS cum_deg FROM ( SELECT extract(year from dte) AS year, extract(doy from dte) AS doy, tavg_c FROM ghcnd_obs WHERE station_id = 'USW00026411' ORDER BY year, doy ) AS foo WHERE doy between extract(doy from '2011-10-01'::date) and extract(doy from '2012-12-19'::date) GROUP BY year ORDER BY year ) AS bar ORDER by rank;
And the results: this has been the fifth coldest early-season winter since 1904.
|O/N/D rank||year||O/N/D cumulative °C||N/D rank|
In addition to the ranks for October through today (O/N/D rank in the table), the last column (N/D rank) shows the same calculation without October temperatures. It’s always a good idea to examine how well a relationship holds up when the interval is manipulated in order to see if the results are an artifact of the choice of period. In this case, the rankings change, but not dramatically.
Tonight we may cross -50°F for the first time this year at our house, but even without the very cold temperatures predicted (but not record cold) through the weekend, the start of the 2012/2013 winter has been exceptionally chilly.
Reading today’s weather discussion from the Weather Service, they state:
LITTLE OR NO SNOWFALL IS EXPECTED IN THE FORECAST AREA FOR THE NEXT WEEK.
The last time it snowed was November 11th, so if that does happen, it will be at least 15 days without snow. That seems unusual for Fairbanks, so I checked it out.
Finding the lengths of consecutive events is something I’ve wondered how to do in SQL for some time, but it’s not all that difficult if you can get a listing of just the dates where the event (snowfall) happens. Once you’ve got that listing, you can use window functions to calculate the intervals between dates (rows), eliminate those that don’t matter, and rank them.
For this exercise, I’m looking for days with more than 0.1 inches of snow where the maximum temperature was below 10°C. And I exclude any interval where the end date is after March. Without this exclusion I’d get a bunch of really long intervals between the last snowfall of the year, and the first from the next year.
Here’s the SQL (somewhat simplified), using the GHCN-Daily database for the Fairbanks airport station:
SELECT * FROM ( SELECT dte AS start, LEAD(dte) OVER (ORDER BY dte) AS end, LEAD(dte) OVER (ORDER BY dte) - dte AS interv FROM ( SELECT dte FROM ghcnd_obs WHERE station_id = 'USW00026411' AND tmax < 10.0 AND snow > 0 ) AS foo ) AS bar WHERE extract(month from foo.end) < 4 AND interv > 6 ORDER BY interv DESC;
Here’s the top-8 longest periods:
Kinda scary that there have been periods where no snow fell for more than a month!
Here’s how many times various snow-free periods longer than a week have come since 1948:
We can add one more to the 8-day category as of midnight tonight.