Code Monkey home page Code Monkey logo

metoffice_ec2's Introduction

metoffice_ec2

All Contributors

Extract specific parts of the UK Met Office's UKV and MOGREPS-UK numerical weather predictions from AWS, compress, and save to S3 as Zarr. Intended to run on AWS EC2.

Install & test locally

conda env create -f environment.yml 
conda activate metoffice_ec2
pip install -e .
py.test -s

If boto3 is setup to access AWS, then you can run scripts/ec2.py from your local machine to test (although it'll try to pull large amounts of data into & out of S3, so this will get expensive quickly!)

Build & test Docker container locally

Install Docker

docker build .
docker run -e AWS_ACCESS_KEY_ID=<ID> -e AWS_SECRET_ACCESS_KEY=<KEY> -e DEST_BUCKET=<BUCKET> -e SQS_URL=<SQS_URL> <DockerImage>

Install on AWS

Architecture Diagram

A Terraform template is provided in /infrastructure. A Docker Image is also provided publicly.

> More Information about Infrastructure

The following environment variables must be provided:

Name Type Description
SQS_URL String The URL of the SQS that the Messages are consumed from
DEST_BUCKET String S3 bucket that the finished output should be stored in
Manual Setup

Configure AWS permissions

Go to the AWS Identity and Access Management (IAM) console... TODO

Create bucket for storing NWPs

Create a bucket for storing subsetted NWPs. Set the DEST_BUCKET constant in scripts/ec2.py

Configure AWS Simple Queue Service (SQS)

When the Met Office uploads new NWPs to S3, they also send a message to an AWS Simple Notification Service topic. These notifications must be received as soon as they're produced. But our EC2 job isn't kept running 24/7. Our EC2 job is triggered once an hour. So we need a way to capture the SNS notifications when our EC2 job is offline.

A solution is to set up an AWS Simple Queue Service. Set up SQS as per the Met Office's instructions.

Then set the SQS_URL in scripts/ec2.py

Configure EC2 instance

Configure EC2 instance to trigger every hour

Software Development

This code follows the Google Python Style Guide.

The included environment.yml file includes just the packages required to run the script and unit tests.

To do development, please run this command within the metoffice_ec2 conda environment:

conda install black flake8 isort jedi mypy

Format the code with black metoffice_ec2 scripts.

Check coding style with flake8.

Fix import order with isort ..

Run static type checking with mypy metoffice_ec2 scripts.

jedi is for auto-completion (and other things) in IDEs.

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Jack Kelly

๐Ÿ’ป

Flo

๐Ÿ’ป

Tom White

๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

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.