Giter Site home page Giter Site logo

ar5-world-bank's Introduction

Climate data processing

This is the documenation for the AR5 climate data processing. Most of the work was done with the R package called raster, and with Python and gdal using the osgeo4w toolset

Converting to GeoTiff

A python script was used to pluck out the years we wanted from the netcdf and then convert them to GeoTiff. The end result was geotiff files in full time-series from 2020-2039, 2040-2059, 2060-2079, and 2080-2099.

Note that this is probably one of the least reusable code sections as it is sort of untidy. Basically it's job though is to create [gdal_translate] (http://www.gdal.org/gdal_translate.html) statements and execute them on specific files

Code for selecting slices of the .NC files and converting to geotiff

Rotating the files

Many climate models a longitudnal scale which runs from 0 -> 360 instead of the standard 0 -> -180. For these data sets we first had to rotate the data

The following image is an example of a raster that neeeds to be rotated. you will notice that you cannot simply shift the raster west because then the hemispheres would not align

Alt text

Code for Iterating through many files and rotating them

Stacking the rasters

The next step involved is stacking the rasters. Instead of having separate rasters for each year, we can us R to stack them up for easier processing. This is basically an exercise using R's stack function in the raster package. We simply grab a chuck that are of the same model, sort them, and then stack them. We have to be very careful that we are sorting them correctly!

Code for stacking rasters

Monthly averages

We want to show the monthly averages for each 20 year period rather than the time-series data because it is more informative. To do that we must average each month within our raster stacks.

We create a raster stack of all the January months, average the stack, write the output, and then move on to the next month.

Code for averaging calculating monthly averages

Masking the data

We found out after processing the global files that we then needed to mask the oceans out of the rasters

Code for masking out the oceans

Clipping each raster against a shapefile with many polygons

To get the average for each country, we make an individual raster for each country boundary. So, we iterate through each country in a world vector file and then clip it against each raster in our dataset. Therefore the number of iterations is num_countries * num_rasters

Shapefiles used for this clipping activity

Code for clipping many rasters against each geom in a shapefile

Average each raster and push output into a csv file

For the API data we have to take the average of each raster and then put it into a csv file, so that it can then be loaded into the API

Code for taking the average for a set of rasters and then putting the output in a csv file

ar5-world-bank's People

Contributors

deriggi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.