This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
NAME | |
imerg_cwd_5mm.py | |
Global IMERG daily indices data extraction | |
DESCRIPTION | |
Input data for this script will use IMERG daily data generated by imerg_nc2tif.py | |
This script can do Consecutive Wet Days (CWD) calculation with threshold 5mm of rainfall as a rainy day | |
PROCESS | |
(i) Extract IMERG's daily rainfall with value greater/less than 5mm (threshold for a day categoried as rainy day) |
This file contains 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
#!/usr/bin/env python | |
""" | |
------------------------------------------------------------------------------------------------------------- | |
Convert CHIRPS GeoTIFF in a folder to single NetCDF file with time dimension enabled that is CF-Compliant | |
http://cfconventions.org/cf-conventions/v1.6.0/cf-conventions.html | |
Based on Rich Signell's answer on StackExchange: https://gis.stackexchange.com/a/70487 | |
This script was tested using CHIRPS dekad data. Adjustment is needed if using other timesteps data for CHIRPS | |
NCO (http://nco.sourceforge.net) must be installed before using this script | |
This file contains 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 | |
# Docker-ubuntu-trusty compatible CDO install script | |
export DEBIAN_FRONTEND=noninteractive | |
apt() { | |
apt-get -qq install $1 &>/dev/null | |
} | |
apt-get update &>/dev/null && apt-get -y upgrade &>/dev/null |
This file contains 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 | |
# Institut für Wetter- und Klimakommunikation GmbH / Qmet | |
# O. Maywald <[email protected]> | |
# This should install CDO with grib2, netcdf and HDF5 support. Note that the binaries are in /opt/cdo-install/bin. | |
# For further information look: | |
# http://www.studytrails.com/blog/install-climate-data-operator-cdo-with-netcdf-grib2-and-hdf5-support/ | |
# docker-command |
This file contains 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
read.fwf2 <- function (file, widths, header = FALSE, sep = "\t", skip = 0, | |
row.names, col.names, n = -1, ...) | |
{ | |
doone <- function(x) { | |
x <- substring(x, first, last) | |
x[!nzchar(x)] <- NA_character_ | |
paste0(x, collapse = sep) | |
} | |
if (is.list(widths)) { | |
recordlength <- length(widths) |