Extending Python

Extending Python

  • Built-in packages
  • 3rd party packages
  • Package management with Conda

Spatial Analysis in Python - the Project

  • Data of coordinates representing the centroid of data
    • Mollewide projection
    • Missing some points
  • Convert coordinates to points
  • Reproject points to WGS84
  • Identify in which country they fall
  • Convert points to areas
  • Intersect with administrative boundaries

Steps

1. Set up

  1. Create GitHub repository
  2. Clone repository to local machine
  3. Update Readme.md file; committ and push
  4. Add folders: Data{raw, processed}, Code
  5. Download raw data (KMCD Migration Data) to data/raw folder
    • https://migration-demography-tools.jrc.ec.europa.eu/data-hub/ ->
      Demography & Migration ->
      Population Change ->
      Net Migration & natural increase at global level (KMCD) ->
      Click on info for download link
    • Unzip file and delete zip
    • Add metadata file
    • Commit data files (IF < 50 MB!)
  6. Add Spyder shortcut
  7. Create Spyder project
    • Create .gitignore file to include .spyproject\*
    • Commit .gitignore file…
  8. Start scripting

2. Pseudo code

  1. Read in the file
  2. Subset based on [lat/long]
    • Need to convert lat long to mollewide coordinates
  3. Convert coordinates to feature class
  4. Draw box around coordinates
    • +/- 12500 m in X,Y direction