Skip to content

Instantly share code, notes, and snippets.

View bennyistanto's full-sized avatar

Benny Istanto bennyistanto

View GitHub Profile
@bennyistanto
bennyistanto / IMERG_cdd_5mm.py
Created March 3, 2022 09:29
Global IMERG daily consecutive dry days data extraction
# -*- coding: utf-8 -*-
"""
NAME
imerg_cdd_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 Dry Days (CDD) calculation with threshold 5mm of rainfall as a rainy
PROCESS
(i) Extract IMERG's daily rainfall with value greater/less than 5mm (threshold for a day categoried as rainy day)
@bennyistanto
bennyistanto / IMERG_cdd_1mm.py
Created March 3, 2022 09:29
Global IMERG daily consecutive dry days data extraction
# -*- coding: utf-8 -*-
"""
NAME
imerg_cdd_1mm.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 Dry Days (CDD) calculation with threshold 1mm of rainfall as a rainy day
PROCESS
(i) Extract IMERG's daily rainfall with value greater/less than 1mm (threshold for a day categoried as rainy day)
@bennyistanto
bennyistanto / mk_gpl2_points_ETH.R
Created February 14, 2022 08:21
google plus level 2 polygons extracted from file previously compiled for MENA/global study
# google plus level 2 polygons extracted from file previously compiled for MENA/global study
# source https://grid.plus.codes/
setwd("D:/sm2/MENA/ge")
reg <- "AFR"
iso = "ETH"
x <- as.list(c("sp","sf","rgdal","rgeos","raster","readxl","dplyr","data.table"))
lapply(x, require, character.only = TRUE)
@bennyistanto
bennyistanto / csvzonal_concat.py
Created February 9, 2022 08:21
Concatenate CSV files by column, and use the date on filename as column name
#!/usr/bin/python
"""
NAME
csvzonal_concat.py
Concatenate CSV files by column, and use the date on filename as column name
DESCRIPTION
Input data for this script will use CSV result from dbf2csv translation
Some notes:
(i) All files required to follow the naming convention "_yyyymmdd.ext"
(ii) ArcGIS Zonal Statistics as Table is use to generate DBF file based on a zone
@bennyistanto
bennyistanto / IMERG_daily_indices_5mm.py
Last active March 4, 2022 13:55
Global IMERG daily indices data extraction
# -*- coding: utf-8 -*-
"""
NAME
imerg_daily_indices_5mm.py
Global IMERG daily indices data extraction
DESCRIPTION
Input data for this script will use IMERG Final or Late Run downloaded from NASA website
This script can do:
(i) Dry days
(ii) Wet days
@bennyistanto
bennyistanto / IMERG_nc2tif.py
Last active February 7, 2022 02:59
Global IMERG daily nc4 translation to GeoTIFF
# -*- coding: utf-8 -*-
"""
NAME
imerg_nc2tif.py
Global IMERG daily nc4 translation to GeoTIFF.
DESCRIPTION
Input data for this script will use IMERG Final or Late Run downloaded from NASA website.
This script can do translation from nc4 to GeoTIFF.
REQUIREMENT
ArcGIS must installed before using this script, as it required arcpy module.
@bennyistanto
bennyistanto / IMERG_daily2monthly.py
Last active September 8, 2023 13:36
Global IMERG daily to monthly
# -*- coding: utf-8 -*-
"""
NAME
imerg_daily2monthly.py
Global IMERG daily to monthly
DESCRIPTION
Input data for this script will use IMERG daily data generated by imerg_nc2tif.py or other
IMERG-based daily products. Example: daily wetdays to monthly sum, daily cdd to monthly max
REQUIREMENT
ArcGIS must installed before using this script, as it required arcpy module.
@bennyistanto
bennyistanto / IMERG_monthlystats.py
Last active February 4, 2022 05:01
Global IMERG monthly statistics data, long-term average, max, min and stdev
# -*- coding: utf-8 -*-
"""
NAME
imerg_monthlystats.py
Global IMERG monthly statistics data, long-term average, max, min and stdev
DESCRIPTION
Input data for this script will use IMERG monthly data generated by imerg_daily2monthly.py
This script can do monthly statistics calculation (AVERAGE, MAXIMUM, MINIMUM and STD)
REQUIREMENT
ArcGIS must installed before using this script, as it required arcpy module.
@bennyistanto
bennyistanto / IMERG_daily2annual.py
Last active March 4, 2022 23:50
Global IMERG annual rainfall
# -*- coding: utf-8 -*-
"""
NAME
imerg_daily2annual.py
Global IMERG annual rainfall
DESCRIPTION
Input data for this script will use IMERG in GeoTIFF format
This script can do annual cell statistics to get SUM or other stat: MEAN, MAX, MIN and STDEV
REQUIREMENT
ArcGIS must installed before using this script, as it required arcpy module.
@bennyistanto
bennyistanto / IMERG_daily_indices_1mm.py
Last active September 8, 2023 13:37
Global IMERG daily indices data extraction with rain day threshold 1mm
# -*- coding: utf-8 -*-
"""
NAME
imerg_daily_indices_1mm.py
Global IMERG daily indices data extraction
DESCRIPTION
Input data for this script will use IMERG Final or Late Run downloaded from NASA website
This script can do:
(i) Dry days
(ii) Wet days