Code Monkey home page Code Monkey logo

gfw-places-to-watch's Introduction

gfw-places-to-watch

Generate new places to watch data when GLAD is updated

About

This code intersects GLAD points with a grid that has been scored for the amount of IFL and WDPA area within each cell. After this intersection, it multiplies the count of GLAD points by the importance score (determined by IFL and WDPA area) to help us identify important places of forest change.

We select the top 10 high scoring grid cells for each region (Central America, South America, Africa, etc) and push them to a CARTO table. These are then surfaced on the staging map under the Uncurated Places to Watch toggle on the GLAD dataset.

These areas are then vetted by our staff to determine what stories we'll share as our offical Places to Watch. With the help of Vizzuality, these get added to a separate CARTO table, and are viewable on the flagship.

Process

How goes this work? We use hadoop_pip to start a hadoop cluster and run the GLAD / grid intersection for us. We then grab the output table (CSV of alerts per grid and the total grid score) and then do the math to figure out the top 10 per region. This data is pushed to the CARTO ptw_top_10 table, then should appear in the uncurated table on the staging map.

Prep

  1. Clone hadoop_pip in the same directory that this repo is sitting in
  2. Create a tokens directory in this repo, with a file called wri-01@cartodb in it that contains our CARTO API token.
  3. Check the processing/hadoop_ptw.ini file to be sure it's up to date. This file contains:
  • Grid polygon TSV: s3://gfw2-data/alerts-tsv/ptw/ptw_grid.tsv
  • Path to GLAD point directory: s3://gfw2-data/alerts-tsv/glad/
  • SQL query to sum alert area_ha and count alerts, grouping by grid ID: SELECT _c3, _c4, sum(_c5), sum(_c6), _c8, _c9, count(*) FROM my_table GROUP BY _c3, _c4, _c8, _c9

Run it!

python update_ptw.py --min-date 2018-07-01 --max-date 2018-09-30

gfw-places-to-watch's People

Contributors

mappingvermont avatar

Stargazers

 avatar  avatar  avatar

Watchers

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

gfw-places-to-watch's Issues

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.