Skip to content
Snippets Groups Projects

Details

Currently, does not support any 2021 data. Also, there is a ~90gb folder of the data that is needed to be able to upload the data to mongodb. Right now, the mongodb database is named gdd_database, and the collection is gdd. Also, takes about 2 seconds per query, trying to find ways to speed it up

The data in mongodb has the following fields:

  • id_ - In the format of year_[prism-latitude]_[prism-longitude]
  • location - GeoJSON object
  • prism_lat - Latitude from the PRISM dataset
  • prism_lon - Longitude from the PRISM dataset
  • last_date - The final date that the data goes to
  • year - Year of the data
  • min_temps - Minimum daily temperature as an array. One element is one day
  • max_temps - Maximum daily temperature as an array. One element is one day

Go to /docs to view the Swagger generated API docs

API Endpoints

  • POST /api/:product/:year
    • Required url params: product and year. Product is the crop (supports corn, soybean, wheat, tomatoes, potatoes, peas, sunflowers, sugar beets, etc.)
    • product must be singular. As in, send "soybean" not "soybeans"
    • Body requires latitude and longitude, t_base is an optional parameter if a farmer decides to set their own base temperater in fahrenheit
    • returns the gdd calculated for that year up to the most recent date of the year. If the year is before the current, the data will cover 01/01 to 12/31. If it is the current year, 01/01 - current date. But the current year is not included

How to run

  • You need the data/ folder with all the netcdf4 files.
  • Call python to_mongo.py to place the data into the mongodb
  • Call node server.js to run the server
  • The preprocess.py is basically useless because you need a lot of files from PRISM that are not included in the repo. Going to need it to build the cron job.