Giter Club home page Giter Club logo

dfg-seasons's Introduction

Status

Falling Fruit Legacy

This is a Rails 3 web application and API for Falling Fruit, built for use with a PostgreSQL + PostGIS database.

Who is responsible?

Falling Fruit co-founders Caleb Phillips and Ethan Welty. More info at fallingfruit.org/about.

How can I help?

If you want to help with development, feel free to fork the project. If you have something to submit upstream, send a pull request from your fork. Cool? Cool!

Status

The website is live at fallingfruit.org. However, maintaining both a website and a mobile app that do not share any code proved too time consuming, so we are slowly phasing out this project in favor of a mobile-friendly web app (falling-fruit-web). However, all versions of the mobile app still rely on the Rails API.

Development

Install PostgreSQL, Ruby, and dependencies

PostgreSQL (15) & PostGIS (3.3), for example with Homebrew:

brew install postgresql@15 postgis

ImageMagick:

brew install imagemagick

Ruby (2.3.4), for example with rbenv:

rbenv install 2.3.4
rbenv shell 2.3.4

Bundler (1.17.3) with RubyGems:

gem install bundler -v 1.17.3

Project gems with Bundler:

bundle install

Initialize the configuration files:

cp config/database.yml.dist config/database.yml
cp config/s3.yml.dist config/s3.yml
cp config/initializers/credentials.rb.dist config/initializers/credentials.rb
cp config/initializers/secret_token.rb.dist config/initializers/secret_token.rb
cp .phraseapp.yml.dist .phraseapp.yml

Add a desired development database name and your database username, password, and port to config/database.yml. Add Amazon S3 and Google API credentials to config/s3.yml and config/initializers/credentials.rb. If working with translations, add Phrase credentials to .phraseapp.yml.

Start the app

Create and structure the database, then seed it with db/seeds.rb:

rake db:create
rake db:migrate
rake db:seed

Install and start the Falling Fruit API.

Finally, start the web server and navigate to localhost:3000:

thin start

Translation

For translators

Website translations are managed on the Phrase project Falling Fruit (web). To contribute, email us ([email protected]) and we'll add you as a translator.

For developers

Install the Phrase CLI:

brew install phrase-cli
cp .phraseapp.yml.dist .phraseapp.yml

Add your Phrase access token to .phraseapp.yml.

Add a new translation

In the Falling Fruit (web) project, select the default locale (English/en), and add a new translation key. If the same word or phrase appears often, add it as glossary.<key name>.

Then, update your translation files (in config/locales/*.yml):

phrase pull

Use the translation key in your template.

<!-- Instead of adding text to the markup: -->
<span>Map</span>

<!-- Evoke the translation key value with translate() -->
<span><%= translate("glossary.map") %></span>

dfg-seasons's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dfg-seasons's Issues

Download daily (hourly) ERA5-Land weather data

@peter-shaw-benson et al.

In case this is helpful, here are some demo scripts for downloading ERA5-Land temperature data at higher temporal resolution.

Note: I suspect that it might actually be faster to retrieve daily data via Google Earth Engine, but I didn't experiment with this approach.

Download daily mean, min, max, or mid via the daily statistics calculator. Results in a 800 MB NetCDF file for each month (for global, full-resolution coverage).

import cdsapi
import requests

c = cdsapi.Client(timeout=300)
year = '2023'
month = '01'
response = c.service(
  'tool.toolbox.orchestrator.workflow',
  params={
    'realm': 'user-apps',
    'project': 'app-c3s-daily-era5-statistics',
    'version': 'master',
    'kwargs': {
      'dataset': 'reanalysis-era5-land',
      'product_type': 'reanalysis',
      'variable': '2m_temperature',
      'statistic': 'daily_mean',
      'year': year,
      'month': month,
      'time_zone': 'UTC+00:0',
      'frequency': '1-hourly',
      'grid': '0.1/0.1',
      'area': {'lat': [-90, 90], 'lon': [-180, 180]} 
    },
    'workflow_name': 'application'
  }
)
url = response[0]['location']
path = f'{year}_{month}.nc'
stream = requests.get(url, stream=True)
print(f'Writing data to {path}')
with open(path, 'wb') as file:
  for chunk in stream.iter_content(chunk_size=1024):
    file.write(chunk)

Download hourly via the original dataset. Results in a 3.6 GB GRIB or NetCDF file for each month (for global, full-resolution coverage).

import cdsapi

c = cdsapi.Client()
year = '2023'
month = '01'
result = c.retrieve(
  'reanalysis-era5-land',
  {
    'variable': '2m_temperature',
    'year': year,
    'month': month,
    'day': [
      '01', '02', '03',
      '04', '05', '06',
      '07', '08', '09',
      '10', '11', '12',
      '13', '14', '15',
      '16', '17', '18',
      '19', '20', '21',
      '22', '23', '24',
      '25', '26', '27',
      '28', '29', '30',
      '31',
    ],
    'time': [
      '00:00', '01:00', '02:00',
      '03:00', '04:00', '05:00',
      '06:00', '07:00', '08:00',
      '09:00', '10:00', '11:00',
      '12:00', '13:00', '14:00',
      '15:00', '16:00', '17:00',
      '18:00', '19:00', '20:00',
      '21:00', '22:00', '23:00',
  ],
    'format': 'grib',
  },
  f'{year}_{month}.grib'
)

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.