Giter VIP home page Giter VIP logo

meteor's Introduction

METEOR

Multivariate Emulation of Time-Emergent fOrced Response

Installation

git clone https://github.com/benmsanderson/METEOR.git

First time setup:

cd METEOR
make first-venv
make clean
make virtual-environment

Update to newer version from github

git pull
make clean
make virtual-environment

If you are still having trouble with missing packages try this:
rm -r venv
make first-venv
make clean
make virtual-environment

Jupyter Notebooks

The notebooks folder provides simple working examples to run the model within a Jupyter environment, and plot example output. Installation instructions for installing Jupyterlab can be found at https://jupyter.org/install METEOR_single_model_pattern_example.ipynb produces a single pattern using CanESM2 data for the base and co2x2 experiments in PDRMIP, using input data text files stored in the tests/test-data folder CMIP6_test.ipynb provides demonstration of the cmip6_meteor_data_getter functionality to get data as xarrays directly from the CMIP6 zarrstore to use in pattern making and predictions. Currently it also demonstrates a couple of approaches to modelling aerosol forcing from residuals. CMIP6_demo_with_residual.ipynb demonstrates how to levarage the inbuilt aerosol forcing from residuals using the cmip6_meteor_data_getter functionality to get data in a minimal way.

scripts

This folder contains example scripts and an example notebook, which might not work out of the box, but require data. test_install.py is a test installation script that should work test_cmip6_read_indata.py demonstrates the cmip6_meteor_data_getter functionality only to make plots of cmip6 input data for a comprehensive list of models. Depending on the specs on your laptop you may run into memory issues for some of the higher resolution models, but otherwise it should work. make_pattern_4xco2_plots.py is a script demonstrating pattern generation from piControl and abrupt-4xco2 experiments using the cmip6datagetter for inputs, should work anywhere. make_cmip6_test_plots.py is a similar script, but used for testing, so might not be a good one to look at for a random user. make_noresm_test.py is a more comprehensive test script which relays on locally available data, which you would need to download if not run on cicero's internal servers. METEOR_multi_model_pattern_example.ipynb is a notebook which similarly relays on locally available data and which produces patterns and plots for four models (CanESM2, GISS-E2-R, NorESM1 and MIROC5) and three different PDRMIP experiments (base, co2x2 and sulx5).

Development

  • To start developing make sure you have a github account and that you are part of the ciceroOslo team.
  • If you haven't already, setup your github account with an ssh key
  • Find a suitable place where you want to start your developement either on windows or under /div/nobakcup/users/yourusername/ and change to that directory
  • Once in the preferred directory with a terminal do:
git clone [email protected]:benmsanderson/meteor.git
  • To make your own branch (which you really should)
git checkout -b your-cool-branch-name
  • Whenever you log in or want to check stuff
git status

It will tell you the branch you are on, changes since last etc

  • To commit your code changes
git add path-of-file-that-changed

Repeat this for all the files that you would want to commit the changes for

git commit -m "A small message to describe the changes"
git push

(The last one is to push the changes to the github version. The first time you do this on a new branch you will need to set where to push to, but how to do that will be suggested when you just do git push)

  • To get new changes that have happened on the main branch is always good before you commit. To do so do:
git checkout main
git pull
git checkout your-cool-branch-name
git merge main

If all goes well this will fill your terminal with a merge message in your default editor, which is likely vim. The message there is likely ok as it is, so to just use that as a commit message for the merge type: :wq which will just save and quit vim and complete the merge with the original commit message.

Then finally just push your code to the web.

git push

The last part is just to pushed this new version of your branch again

Test suite and environment

The code comes with a suite of tests and tools. To use this you must do:

make first-venv
make virtual-environment

This should only be necessary the first time you setup the code You can load this environment with

source venv/bin/activate

Later to update you should do: make virtual-environment

Or if you know you need updates, but aren't getting them:

make clean
make virtual-environment

After this you should be able to run the automatic tests make test will only run the tests make checks will run the tests and formatting tests

Before your code branch can be merged into the main code, it has to pass all the tests (The makefile also has an option to run only the formatting checks) Tests are located in tests in tests/test-data/ data for testing against fortran runs and test input data are stored. In tests/unit there are unit tests for certain methods. In test/integration there are integration tests of the code. When you develop new code, try to think about what can be done to test and validate that your code does what you expect it to do, and try to integrate such tests into the automatic testing scheme.

General code flow

meteor.py contains the main control module, prpatt.py is a library with functions to fit parameters to define synthetic PC timeseries to processes PDRMIP output, as well as functions to run convolve synthetic PCA with a user-defined forcing timeseries. scm_forcer_engine.py provides a wrapper to enable using the ciceroscm simple climate to estimate forcing strength from emissions. meteor_plot_utils.py provides some simple plotting functionality. cmip6_meteor_data_getter.py has functions to define and access CMIP6 data as xarrays from cloud storage, meaning you can use cmip6 data with meteor with out going through a huge download and data wrangling process before going ahead. This can also be leveraged on it's own to get cmip6 data to plot and explore.

meteor's People

Contributors

benmsanderson avatar maritsandstad avatar

Stargazers

George Xexakis avatar

Watchers

 avatar  avatar  avatar

meteor's Issues

fix PDRMIP_spatial_emulator.ipynb example script

Need to clean up and fix a few lines in PDRMIP_spatial_emulator.ipynb.

'import library of functions for model':
location of prpatt library has (apparently) changed, so I had to add the lines:

import sys
sys.path.append('src/meteor/')

Also, the functions 'imodel_eof' and 'imodel_filter' are no longer defined in the prpatt library (probably for a good reason). If no longer used, need to clean up the example script.

While at it, it might be a good idea to set up a proper example script of the current functionalities of METEOR for new users.

README update

Need to update the README file.
Add all steps necessary installation steps to setup and run METEOR (i.e., example scripts, like the two existing python notebooks).

Make notebook to simulate 1pctCO2 response

@speatier - I've done a first super-simple demonstration case using the test data for CanESM- our next step could maybe be to make a second notebook with some scientific validation. For example, simulate the 1pctCO2 simulation for CanESM and compare with the truth.

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.