FCResults

FetchClimate is a service from the Computational Ecology and Environmental Science Group at Microsoft Research. You can use it via a web browser by checking out www.fetchclimate.org. The real power of FetchClimate is for developers, making it possible to pull in geospatial data programmatically into your apps.

Full details of FetchClimate are at – http://research.microsoft.com/en-us/projects/fetchclimate/default.aspx

You can download the developer documentation here and the .NET client library and utility here.

Here are some code samples to get you going. This is a very simple C# example.

C# code sample

double[] Latitudes = { 37.4, 29.63, 30.73, 43.4167, 43.7667, 8.9833, 42.9666, 68.35, 68.35, 50.1833, 26.5, 10, 27.6667, -12.7, -12.7, -12.4, 40.05, 35, 34.6, 33.33, 43.03, 51.1487, 68.6333 };

double[] Longitudes = { -122.25, -82.36, -82.13, 6.5833, 3.7, -79.55, 141.3833, 18.8166, 18.85, 11.5, 83, -85, -98.2, 131, 131, 130.9, -105.6, -83.5, -106.9, -79.217, -89.4666, 18.0635, -149.5667 };

double[] fetchTemperature = ClimateService.FetchClimate(ClimateParameter.FC_LAND_AIR_TEMPERATURE, Latitudes, Latitudes, Longitudes, Longitudes);

Here are instructions on using FetchClimate from R (courtesy of Matthew Smith at Microsoft Research):

  1. Download the latest code
  2.  Run R, install dependencies: install.packages(“RCurl”,”RJSONIO”,”sp”)
  3. Loading code: source(“FetchClimate.R”)

Available functions:

  • fcTimeSeriesYearly
  • fcTimeSeriesDaily
  • fcTimeSeriesHourly
  • fcGrid

R Examples:

Fetching single time series

ts <- fcTimeSeriesYearly(

variable=”airt”,

latitude=75.0, longitude=57.7,

firstYear=1950,lastYear=2050,

url=”http://fetchclimate2staging3.cloudapp.net/“)

 

Drawing  time series with CI

plot(ts$years,ts$values, type=”l”,xlab=”years”,ylab=”DegC”,ylim = c(-20,0)) lines(ts$years,ts$values+ts$sd,type=”l”,lty=2) # + 1 sigma lines(ts$years,ts$values-ts$sd,type=”l”,lty=2) # – 1 sigma

 

Fetching time series

data(quakes) #the only built-in dataset with locations which I’ve found. The Fiji earthquakes

ts <- fcTimeSeriesDaily( #fetching day-to-day temperature variations at earthquake locations

variable=”airt”,

latitude=quakes$lat, longitude=quakes$long,

firstYear=1981, lastYear=2000 #averaging across 20 years

)

matplot( #plotting

t(ts$values[1:30,]), # plotting first 30 time series out of 1000

type=”l”,

xlab=”days”,ylab=”DegC”)

 

The plot:

Fetching grids

 

africaJulyTempLand <- fcGrid(variable=”airt_land”,

latitudeFrom=-35, latitudeTo=35, latitudeBy=1,

longitudeFrom=-20,longitudeTo=60,longitudeBy=1,

firstDay=182,lastDay=212, #July

firstYear=1950,lastYear=2000)

spplot(africaJulyTemp,”values”)

 

 

africaJulyTemp <- fcGrid(variable=”airt”,

latitudeFrom=-35, latitudeTo=35, latitudeBy=1,

longitudeFrom=-20,longitudeTo=60,longitudeBy=1,

firstDay=182,lastDay=212, #July

firstYear=1950,lastYear=2000)

spplot(africaJulyTemp,”values”)

 

Plotting provenance for the same grid:

spplot(africaJulyTemp,”provenance”)

Plotting uncertainty (SD) for the same grid :

spplot(africaJulyTemp,”sd”)