Coder Social home page Coder Social logo

jgomezdans / geog0133-practicals Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 3.0 1.71 MB

Practicals for UCL's Department of Geography Geog0133: "Terrestrial Carbon: modelling and monitoring"

License: GNU General Public License v3.0

Jupyter Notebook 97.03% CSS 0.15% Python 2.82%
carbon-emissions climate-change climate-model earth-observation remote-sensing vegetation-dynamics vegetation-model

geog0133-practicals's Introduction

GEOG0133 Terrestrial Carbon: modelling and monitoring

J Gómez-Dans & P Lewis

You can run the practicals directly online, thanks to the Binder infrastructure. Here's a link to the whole repository, and individual practicals will be linked below.

Binder

Practical 1: A simple Earth System Model

Binder

This exercise aims to show a very simple energy balance model of the Earth system.

Practical 2: Per Capita Carbon emissions

Binder

A simple exercise to understand carbon emissions. Includes fitting some very simple models.

Practical 3: Photosynthesis modelling

Binder A practical where the Farquhar approach to photosynthesis in vegetation is used to explore how vegetation is modelled in typical dynamic global vegetation models (DGVMs). The practical allows you to understand (some of) the limits to photosynthetic activity in vegetation, as well as explore the role of plant functional types (PFTs) in controlling photosynthesis. The final aim is to think how this basic leaf-level model can form the basis of a vegetation carbon model.

Practical 4: Phenology

Binder Phenology is the study of recurrent natural phenomena. In this practical, you will try to develop models for vegetation phenology based on observations of plant "greenness" derived from satellite data, as well as abiotic controls (mostly temperature!).

Running on your own computer

If you want run this on your own computer, you can do that easily. Follow these steps:

  1. First, download or clone the entire repository. a. You can download everything as a zip file, and uncompress it, b. ... Or you can do git clone https://github.com/jgomezdans/geog0133-practicals if you have git installed

  2. Make sure you have Anaconda Python installed, and in the folder with the practicals issue the following command:

    conda env create -f environment.yml
    
  3. The previous command can take a while to run, and needs the internet to download stuff.

  4. You can then (hopefully) just run jupyter notebook on that folder

geog0133-practicals's People

Contributors

aclong avatar jgomezdans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

geog0133-practicals's Issues

File is not a zip file error for request in grab_data()

Get the error BadZipFile: File is not a zip file when loading in phenology.py.

Th response from loading in:

def grab_data(url="https://www.dropbox.com/sh/6wt85sf0ubc9e8n/AACberbeIDG39yzjppNzhHMha?dl=0"):
    fnames=["NDVI_2001.tif", "NDVI_2002.tif", "NDVI_2003.tif", 
            "NDVI_2004.tif", "NDVI_2005.tif", "NDVI_2006.tif", 
            "NDVI_2007.tif", "NDVI_2008.tif", "NDVI_2009.tif",
            "NDVI_2010.tif", "NDVI_2011.tif", "temp_2m.tif"]
    print(f"{time.asctime():s} -> Please wait while I get hold of the data")
    
    if not os.path.exists("./data/"):
        os.mkdir("./data")
    r = requests.get(url, stream=True)
    
    if r.status_code == 200:
        
        with open("./temporal.zip", 'wb') as f:
            
            for chunk in r:
                
                f.write(chunk)

        zipper = zipfile.ZipFile("./temporal.zip")
        
        zipper.extractall("./data/")
        
        print(f"{time.asctime():s} -> Successfully downloaded data!")
        
    raise IOError("SOmething happened")

It looks like the file created here:

with open("./temporal.zip", 'wb') as f:
            
            for chunk in r:
                
                f.write(chunk)

is actually in .html format

error with photJules

when trying to run


do_photosynthesis('a')

get the error:


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-3-984accf6a1af> in <module>
     82 
     83 
---> 84 do_photosynthesis(name='a')

<ipython-input-3-984accf6a1af> in do_photosynthesis(n, name, ipar, Tc, x, xlabel, co2_ppmv, C3, pft_type, plot)
     56 
     57     # calculate leaf and canopy photosynthesis
---> 58     photo.photosynthesis()
     59 
     60     if plot:

/data/store05/phd/data/ucfnacl/geog0111/photJules.py in photosynthesis(self)
     79 
     80         '''
---> 81         self.leafPhotosynthesis()
     82         self.canopyPhotosynthesis()
     83 

/data/store05/phd/data/ucfnacl/geog0111/photJules.py in leafPhotosynthesis(self)
    463         self.gl = self.ratio * glco2
    464 
--> 465         self.Al[w] = -self.Rd * self.beta
    466 
    467         # quadratic for O3

ValueError: shape mismatch: value array of shape (100,) could not be broadcast to indexing result of shape (11,)

xelatex

If you try to save the notebook as pdf, it says you need this, so might be worth including.

Also, whilst users can save the notebook locally after experimenting, they can’t save the files directly — we should offer some advice on this eg download the git, then run on binder if you like, but if you save your work to your gut, you can re-run it.

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.