This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This installs CDO with ecCodes, netCDF and HDF5 support. Uses standard locations, with binaries landing in /usr/local/bin | |
# Forked from https://gist.github.com/mainvoid007/e5f1c82f50eb0459a55dfc4a0953a08e | |
# Updated to latest versions | |
# The only “breaking” change for JasPer is the maintainer switched from make to cmake for its build | |
cdo_path=/opt/cdo-install | |
apt-get update && apt-get install -y wget build-essential checkinstall unzip m4 curl libcurl4-gnutls-dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def daylength(dayOfYear, lat): | |
"""Computes the length of the day (the time between sunrise and | |
sunset) given the day of the year and latitude of the location. | |
Function uses the Brock model for the computations. | |
For more information see, for example, | |
Forsythe et al., "A model comparison for daylength as a | |
function of latitude and day of year", Ecological Modelling, | |
1995. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A(models.Model): | |
things = models.ManyToManyField("B", through=ThroughModel) | |
class B(models.Model): | |
text = models.TextField() | |
class ThroughModel(models.Model): | |
a = models.ForeignKey(A) | |
b = models.ForeignKey(B) | |
extra = models.BooleanField() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Gets the name of the active Git branch as a string. | |
Depends on GitPython | |
pip install GitPython | |
""" | |
from git import Repo | |
repo = Repo('/path/to/your/repo') | |
branch = repo.active_branch |