Skip to content

Instantly share code, notes, and snippets.

View bennyistanto's full-sized avatar

Benny Istanto bennyistanto

View GitHub Profile
@bennyistanto
bennyistanto / future_geospatial_ecosystem.svg
Created February 21, 2025 13:09
Visual diagram showing the relationship between the three frameworks of geospatial ecosystem
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bennyistanto
bennyistanto / delete_gee_assets.md
Created February 11, 2025 08:56
Delete EarthEngine Assets

Delete EarthEngine Assets

WARNING:
This code permanently deletes the specified asset folder and all its contents. Please double‑check the asset path before running.

  1. Authentication and Initialization:
    The script begins by calling ee.Authenticate() (only when needed) and ee.Initialize().

  2. delete_folder_contents Function:

  • Uses ee.data.listAssets({'parent': folder}) to list all children assets.
@bennyistanto
bennyistanto / chirps3_rolling_dekad.md
Created February 5, 2025 00:27
CHIRPS3 Rolling Accumulation Processor

CHIRPS3 Rolling Accumulation Processor

This script processes CHIRPS (Climate Hazards Group InfraRed Precipitation with Station data) version 3.0 dekadal (10-day) rainfall data to create rolling accumulations over various time periods. It's particularly useful for climate monitoring and drought analysis.

Prerequisites

  • CHIRPS3 dekadal data (.tif files) downloaded from CHIRPS3 website
  • Python 3.x
  • Required Python packages:
  • rasterio (version > 1.3)
@bennyistanto
bennyistanto / geest_012_feedback.md
Last active October 4, 2024 10:59
GEEST 0.1.2 feedback

GEEST2 on QGIS for Windows, LTR 3.34.4-Prizren

Tab: Project

Suggestion

  1. Almost missed the folder icon on the right side 😃. I think it's better to put it on the left side and below the label Working Directory.
  2. After setting the directory, whenever we close and open it again, the last Working Directory has been set, this is inline with what Tim explain about setting in JSON file.
    I think it would be good if we have a "Reset" button on this page. The function is to make everything like a fresh start and to prevent users from using unwanted folders.
  3. We need to add a NOTE label (with the "i" icon also fine) above the 'Study Area Layer" with the text: Below combo-box will active if you have a polygon (it can be an administrative boundary or just a bounding-box polygon), active as a Layer. If you haven't done so yet, you can add it from the menu editor Layer > Add Layer > Add Vector Layer.
@bennyistanto
bennyistanto / titanic_exercises_part2_Q7.md
Created September 22, 2024 01:12
HarvardX-PH125.8x Data Science Machine Learning, Titanic Exercises, part 2 Q7: Survival by fare - Loess

HarvardX-PH125.8x Data Science Machine Learning

Question 7: Survival by fare - Loess

Set the seed to 1. Train a model using Loess with the caret gamLoess method using fare as the only predictor.

What is the accuracy on the test set for the Loess model?

Note: when training models for Titanic Exercises Part 2, please use the S3 method for class formula rather than the default S3 method of caret train() (see ?caret::train for details).

@bennyistanto
bennyistanto / geest_ntl.md
Last active August 27, 2024 13:15
Test NTL data process for GEEST

PyQGIS NTL Clipping, Classification, and Visualization

Screenshot 2024-08-27 194434

Overview

This script is designed to run within the PyQGIS console and provides a complete workflow for processing Night Time Lights (NTL) data. The script performs the following tasks:

  1. Clipping - Clips the global NTL raster data to the boundary of a specified country or region.
  2. Classification - Classifies the clipped NTL data into 6 classes using the GEEST Safety Classification standard.
@bennyistanto
bennyistanto / geest_color.md
Last active August 27, 2024 23:24
Colorblind safe for GEEST classification

Colorblind safe for GEEST classification

geest_normal

The existing color scheme in the image uses a predominantly orange-red palette for most of the map, with some yellows, greens, and blues appearing minimally. While this scheme does show variation, it has several limitations. The heavy use of similar orange and red hues makes it difficult to distinguish between different levels of enablement and population, especially in the low to moderate ranges. Additionally, this color scheme may not be easily interpretable for individuals with color vision deficiencies.

I propose changing to a more effective color scheme based on the ColorBrewer RdYlBu (Red-Yellow-Blue) 5-class diverging color palette.

Baseline color 5-class RdYlBu

@bennyistanto
bennyistanto / Enhanced_NTL_class_for_GEEST.md
Last active August 24, 2024 07:46
Enhanced Night Time Light (NTL) Classification for GEEST

Enhanced Night Time Light (NTL) Classification for GEEST

Approach and Rationale

We propose refining the NTL classification in GEEST to better reflect local conditions, particularly for small island countries. Instead of using fixed thresholds or coverage percentages, we'll employ local statistics to create a more contextually relevant classification. This approach is supported by Elvidge et al. (2013), who emphasize the importance of considering local context in night-time light analysis.

Standard Classification Procedure:

  1. Clip the global NTL raster to the country boundary.
  2. Calculate statistics for the clipped raster: min, max, mean, median, and 75th percentile.
@bennyistanto
bennyistanto / 0_rainfall_distribution.md
Last active September 30, 2024 16:43
Rainfall distribution analysis and visualisation

Rainfall Distribution Analysis

This rainfall distribution analysis script provides a comprehensive examination of observed and satellite-based daily precipitation data, offering valuable insights for hydrologists, climatologists, and water resource managers. The analysis begins by generating synthetic rainfall data to simulate both ground observations and satellite estimates, including the introduction of extreme events. This approach allows for a controlled comparison between different data sources and methods of analysis.

The script employs a range of advanced statistical techniques to characterize precipitation patterns and extreme events. It utilizes the method of L-moments to fit Gamma distributions to the overall rainfall patterns, providing a robust representation of the general precipitation behavior. For extreme rainfall events, the script applies Generalized Pareto Distributions (GPD) and incorporates cross-validation techniques to ensure reliable modeling of these critical occurrences. This dua

@bennyistanto
bennyistanto / moving_window.md
Created July 2, 2024 07:18
The moving window approach is used to balance the advantages of capturing both spatial and temporal variations in precipitation patterns

Moving Window illustration

You can paste the below code into an online Python compiler like https://python-fiddle.com/ and grab the result instantly.

This script will generate a plot that illustrates:

  1. This highlighting the spatial moving window on the top layer. The selected pixel at (4,5) will be red, and the 24 surrounding pixels within the 5x5 window will be pink.
  2. This illustrate how the temporal moving window considers data from multiple layers (time steps) when smoothing the value for a single pixel.

The moving window approach is used to balance the advantages of capturing both spatial and temporal variations in precipitation patterns. By considering both spatial and temporal windows, the bias correction method can address local variations and seasonal changes more effectively.