GithubHelp home page GithubHelp logo

florida_hurricane_finder's Introduction

Code results

Hurricane data has been written to florida.csv.

Setting up

  1. Install node: https://nodejs.org/en/download. The latest LTS version should do.
  2. Install pnpm: https://pnpm.io/installation.
  3. Run pnpm install to install all packages.
  4. Install sqlite3.

Running it

The user needs to supply the right environment variables to get the scripts to run properly.

  1. Run DB=<desired_path_to_db> pnpm create_db.
  2. Run DB=<desired_path_to_db> pnpm load_db.
  3. Run OUTPUT_PATH=<desired_output_file> DB=<db path> pnpm write_hurricanes.

The hurricane data should be in the file referenced by the output path.

How does it work

The code loads the NOAA hurricane data into a SQLite3 database. I chose this approach because SQL databases make it easy to do things like rapidly query for all hurricane data that belongs to a particular cyclone number, or find the maximum wind speed for a particular cyclone number.

I then iterate through all hurricanes that have occurred since 1900 and for each row of hurricane lng/lat data, I compare the lng/lat to the Florida coastline to see if the lng/lat ever went inside it.

To accomplish this coastline check, I downloaded a GeoJSON file from https://github.com/danielcs88/fl_geo_json. I then used TurfJS, an open-source library maintained by MapBox, to detect whether the lng/lat was inside Florida.

Possible areas for future improvement

  1. Preemptively check points to see if they are in a bounding box for Florida (i.e. a big box that encompasses Florida). If a point is outside of this bounding box, we can skip checking it against the fine-grained Florida GeoJSON and speed the process up.
  2. Add validation before entering data into the database.
  3. Support emitting data to other file formats.
  4. Add an automated test suite.
  5. Throw the whole thing out and rewrite in a language that supports multiple threads. The checks for each hurricane are expensive and the main bottleneck probably and Node/TS may not the best fit for this problem.
  6. Use this Florida GeoJSON from the Florida Fish and Wildlife Commission instead: https://geodata.myfwc.com/datasets/myfwc::florida-shoreline-1-to-40000-scale/explore?location=27.438860%2C-82.763397%2C10.39

florida_hurricane_finder's People

Contributors

janedotx 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.