Skip to content

Instantly share code, notes, and snippets.

View bennyistanto's full-sized avatar

Benny Istanto bennyistanto

View GitHub Profile
@bennyistanto
bennyistanto / Join_from_ZonalStats_NDVI.ipynb
Last active October 23, 2023 15:19
Join data attribute based on csv's KEY FIELD with DBF output from ArcGIS Zonal Statistics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bennyistanto
bennyistanto / max_and_date_arcpy.py
Created September 7, 2023 10:51
Get annual maximum of daily rainfall and when it happen from time-series daily rainfall data in a year
import sys
import numpy as np
import arcpy
import datetime
arcpy.env.overwriteOutput = True
# ---- You need to specify the folder where the tif files reside ----
src_flder = r"Y:\3days\2017" # just change the year
out_flder = r"Y:\3days\2017_output" # make a result folder to put stuff
@bennyistanto
bennyistanto / UnitHydrographs.ipynb
Last active September 4, 2025 18:46
Obtain a Unit Hydrograph for a basin using the rainfall and streamflow data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bennyistanto
bennyistanto / Parsing BMKG's daily climate data.ipynb
Last active August 19, 2023 16:11
Parsing daily climate data in a xlsx, downloaded from BMKG's Data Online
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bennyistanto
bennyistanto / FourierRegressionModel_monthly2daily_Temperature.ipynb
Created August 9, 2023 08:06
Fourier regression model to generate daily time series from monthly temperature data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bennyistanto
bennyistanto / SPI-based drought characteristics.ipynb
Last active December 16, 2025 21:21
SPI or SPEI based Drought Characteristics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bennyistanto
bennyistanto / GetGeoTransform.md
Created July 13, 2023 00:20
Creating arrays from GeoTIFFs

From below script:

ds = gdal.Open('../SPI/mar/orig_geotiff/mar_cli_chirps_precip_month1_198101.tif') # Data location

a = ds.ReadAsArray()
nlat,nlon = np.shape(a)

b = ds.GetGeoTransform() #bbox, interval
lon = np.arange(nlon)*b[1]+b[0]
@bennyistanto
bennyistanto / download_era5_agromet.py
Created May 4, 2023 02:11
Download ERA5 Agrometeorological Indicators and save as 1 month data in 1 netCDF file
"""
NAME
download_era5_agromet.py
DESCRIPTION
Download ERA5 Agrometeorological Indicators and save as 1 month data in 1 netCDF file.
REQUIREMENT
You must registered as CDS Copernicus user, and access your profile to get UID and Api Key
You need to install `cdsapi` python package
EXAMPLES
python download_era5_agromet.py
@bennyistanto
bennyistanto / PhenoMetrics_Merge_Output.ipynb
Last active April 21, 2023 13:29
Merge output from Seasonality data extraction process
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
"""
NAME
chirps_dekad_update.py
Update Global CHIRPS's dekad collection in a folder, gunzip, rename and compress
DESCRIPTION
This script will do:
1. Check the exisiting file in the Dekad folder, match the date `..._YYYY.MM.D.tif`
with collection files in BASE_URL
2. If the file exist in the Dekad folder, then skipped, proceed to next date.