Code Monkey home page Code Monkey logo

ohiprep's People

Contributors

bbest avatar jamiecmontgomery avatar jules32 avatar katlongo avatar katrinleinweber avatar mcfraziers avatar melsteroni avatar ningningj avatar oharac avatar omalik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ohiprep's Issues

transportability of code

Minor issue I am dealing with when trying to recreate the pressure layers from raw data. I first download the data from the original sources (thank you very much for providing links to those). Then, I changed the working directories in your code to my local machine. Subsequently, all calls using substr do not work because my working directory, which influences the full file path, is different. I have changed the code on my local machine to use gsub("\\.[a-z]{3}", "", sapply(strsplit(x, "-|_"), tail, 1)), which will work for some of the uses of substr to pull out the year.

consider using R package and API for WorldBank data

Relevant to Global/WorldBank-WGI_v2013.

Also see:

README.md from R library WDI...

World Bank Development indicators for R

The World Bank makes available a ton of great data from the World Development Indicators through its web API. The WDI package for R makes it easy to search and download data series from the WDI.

Installation

WDI is published on CRAN and so can be installed by simply typing this in the R console:

install.packages('WDI')

Searching for data

You can search for data by using keywords in WDIsearch. For instance, if you are looking for data on Gross Domestic Product:

WDIsearch('gdp')

Which produces this:

> WDIsearch('gdp')[1:10,]
      indicator              name                                                                      
 [1,] "BG.GSR.NFSV.GD.ZS"    "Trade in services (% of GDP)"                                            
 [2,] "BM.KLT.DINV.GD.ZS"    "Foreign direct investment, net outflows (% of GDP)"                      
 [3,] "BN.CAB.XOKA.GD.ZS"    "Current account balance (% of GDP)"                                      
 [4,] "BN.CUR.GDPM.ZS"       "Current account balance excluding net official capital grants (% of GDP)"
 [5,] "BN.GSR.FCTY.CD.ZS"    "Net income (% of GDP)"                                                   
 [6,] "BN.KLT.DINV.CD.ZS"    "Foreign direct investment (% of GDP)"                                    
 [7,] "BN.KLT.PRVT.GD.ZS"    "Private capital flows, total (% of GDP)"                                 
 [8,] "BN.TRF.CURR.CD.ZS"    "Net current transfers (% of GDP)"                                        
 [9,] "BNCABFUNDCD_"         "Current Account Balance, %GDP"                                           
[10,] "BX.KLT.DINV.WD.GD.ZS" "Foreign direct investment, net inflows (% of GDP)" 

WDIsearch uses grep and ignores cases, so you can also use regular expressions. For instance, if you are looking for GDP per capita in constant dollars:

WDIsearch('gdp.*capita.*constant')
     indicator           name                                                 
[1,] "GDPPCKD"           "GDP per Capita, constant US$, millions"             
[2,] "NY.GDP.PCAP.KD"    "GDP per capita (constant 2000 US$)"                 
[3,] "NY.GDP.PCAP.KN"    "GDP per capita (constant LCU)"                      
[4,] "NY.GDP.PCAP.PP.KD" "GDP per capita, PPP (constant 2005 international $)"

Download and use the data

Download a series you like for the countries you like:

dat = WDI(indicator='NY.GDP.PCAP.KD', country=c('MX','CA','US'), start=1960, end=2012)

Look at the data:

head(dat)
  iso2c country NY.GDP.PCAP.KD year
1    CA  Canada       9374.883 1960
2    CA  Canada       9479.824 1961
3    CA  Canada       9967.366 1962
4    CA  Canada      10290.362 1963
5    CA  Canada      10774.653 1964
6    CA  Canada      11283.606 1965

Plot the data:

library(ggplot2)
ggplot(dat, aes(year, NY.GDP.PCAP.KD, color=country)) + geom_line() + 
    xlab('Year') + ylab('GDP per capita')

GDP per capita in North America

Note: You can use country='all' to download data for all available countries. You can also feed a vector of indicator strings if you want to download multiple indicators at once.

Updating series list

To speed up search, WDI ships with a local list of all available WDI series as of 2012-06-18. This list will be updated semi-regularly, but you may still want to update it manually to get access to the very latest data series. To do so, use the cache function:

new_cache = WDIcache()
WDIsearch('gdp', cache=new_cache)

Bugs, suggestions, etc.

Thanks for using WDI! Please send all bug reports and suggestions through the github issue tracker or by email at [email protected]

@Gissues:{"order":50,"status":"inprogress"}

use DataPackage for documenting Layers

Incorporate R and Python packages for this simple data package format.

This limitation of 10 characters for shapefiles is uber lame, eg README.md explaining Antarctic specific set of shapefiles here:

\\neptune\data_edit\git-annex\Global\NCEAS-Regions_v2014\data
  • antarctica_ccamlr_alleez_gcs.shp: CCAMLR regions before being clipped by EEZs
    • area_orig_ -> area_orig_km2
  • antarctica_ccamlr_ohi2014_gcs.shp: CCAMLR regions after being clipped by EEZs with the following fields explained:
    • area_orig_ -> area_orig_km2
    • area_km2
    • area_pct_o -> area_pct_orig: area_km2 / area_orig_km2 * 100

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.