Sources and measurements
Sources and measurements
Every number and fact in the chapters comes either from a cell output in the same chapter or from a row of this table. A chapter that writes ledger L1 points to row L1 below.
Each row has a status:
- MEASURED: computed for this tutorial; the row names the command, script or notebook run.
- CITED: read in a primary source on the date given; the row links to it.
- VERIFY: believed but not yet confirmed. The chapters do not rely on these rows.
The public repository holds the two scripts that the chapters name, scripts/scrape_datanonkom.py and scripts/fetch_chirps_cog.py. The other scripts this table names, under scripts/ and temp/, are in the author’s working repository, which is not public.
The table is in English on both language versions of this page.
Ledger
| ID | Fact | Status | Source |
|---|---|---|---|
| L1 | The datanonkom page “Data Iklim Pertanian” has two topics. topik=2 OPT Utama (main pests): variabel 5 Padi, 6 Jagung, 7 Kedelai. topik=3 DPI (impact of climate change: flood and drought): variabel 8 Banjir Padi, 9 Banjir Jagung, 10 Banjir Kedelai, 11 Kekeringan Padi, 12 Kekeringan Jagung, 13 Kekeringan Kedelai. Klasifikasi 2 Terkena (affected), 3 Puso (crop failure). Bulan 1-12 and 13 Setahun (annual). Vertikal 1 Nasional, 2 Provinsi, 3 Kabupaten/Kota. Unit ha. Years offered in the form: 2002-2026 |
MEASURED 2026-11-30 | form inputs of https://datanonkom.pertanian.go.id/master/iklim/data?topik=3&tampilan=1, read in a browser |
| L2 | The page prints “Data update per tanggal …” and, for each variable, “514 wilayah · 13.364 record”. The printed date depends on the selection: 27 November 2026 when 2026 is among the selected years, 7 September 2026 for a request with 2016, 2021 and 2025 only | MEASURED 2026-11-30 | data page in a browser (tampilan=2), and three live requests by the Java data check (temp/verify-datanonkom-2026-11-30/cmp_live.txt) |
| L3 | robots.txt of datanonkom allows / and disallows /login, /logout, /api/, /admin, /*/export and /cari/ |
MEASURED 2026-11-30 | https://datanonkom.pertanian.go.id/robots.txt |
| L4 | The data table shows at most 200 region rows (“Menampilkan maks. 200 baris wilayah”). The q parameter filters by region name: q=Indramayu returned one row (code 3212); q=33, a code prefix, returned none |
MEASURED 2026-11-30 | browser checks of /master/iklim/data with q |
| L5 | One request can carry several tahun[], variabel[], klasifikasi[] and bulan[] values; the table repeats its columns per variable, year, month and class. The tampilan=2 view adds an INDONESIA row equal to the sum of the rows shown |
MEASURED 2026-11-30 | browser check with q=Indramayu, variabel 8 and 11, eight years |
| L6 | Kab. Indramayu (3212), Kekeringan Padi, Setahun: no record (“-”) for 2002, 2005, 2010 and 2015; terkena / puso in ha: 2019 20,136.50 / 13,653.00; 2020 2,085.00 / 566.00; 2023 9,762.00 / 3,018.00; 2025 173.00 / 0.00. Banjir Padi has no record for the same four early years. (Why: “-” marks the years before the database period, the same for every Java region, ledger L18) | MEASURED 2026-11-30 | https://datanonkom.pertanian.go.id/master/iklim/data?topik=3&tampilan=2&variabel[]=11&variabel[]=8&klasifikasi[]=2&klasifikasi[]=3&bulan[]=13&vertikal=3&q=Indramayu&tahun[]=2002&tahun[]=2005&tahun[]=2010&tahun[]=2015&tahun[]=2019&tahun[]=2020&tahun[]=2023&tahun[]=2025 |
| L7 | Licence or terms of use of the datanonkom data: no licence or terms text on the data page (a cached copy searched for licen, lisensi, syarat and terms: the one hit, syarat, is page JavaScript); the footer reads “© 2026 Database Non Komoditas”. Other pages of the site and the ministry were not searched | MEASURED 2026-12-01 (page as cached 2026-11-30) | cached data page in E:/temp/pgci/datanonkom/java/raw |
| L8 | For Java, the 119 datanonkom region codes equal the a2bps (BPS) codes of the 2022 kabupaten/kota boundary layer one to one (that layer’s two features with code 0 left out). Names are identical for 34 codes and differ only by a “Kab.” prefix on datanonkom for 85. Provinces outside Java not checked |
MEASURED 2026-11-30 | python scripts/check_datanonkom.py on the Java scrape of 2026-11-30, section 6, with idn_bnd_adm2.shp |
| L9 | The datanonkom data table is part of the server-rendered HTML page (no separate data request), and the site is served through Cloudflare | MEASURED 2026-11-30 | network log of the data page in a browser |
| L10 | Local CHIRPS v3.0 daily archive (Earth Engine exports UCSB-CHC/CHIRPS/V3/DAILY_RNL and DAILY_SAT, Indonesia box 94-142 E, 12 S-7 N): rnl covers 1981-01-01 to 2026-09-30 (16,709 days, none missing, 556 files, 11.12 GB); sat covers 1998-01-01 to 2026-09-30 (10,500 days, none missing, 352 files, 6.74 GB). Three files per variant (2018-09-05..25, 2023-08-31, 2023-09-01..20) are pilot exports whose days other files also hold |
MEASURED 2026-11-30 | python scripts/inventory_chirps.py on H:/temp/chirps/daily; collection IDs from the export manifests in pycpt_CHIRPS3_IDN_manifest/ |
| L11 | The CHIRPS daily GeoTIFFs are EPSG:4326, 0.05 degree, 961 x 381 cells, float32, one band per day named dYYYYMMDD, nodata -9999. Nodata is encoded two ways: in band 1 of January 2024, 262,888 cells equal -9999 and 1,341 cells are NaN |
MEASURED 2026-11-30 | python scripts/inventory_chirps.py --sample 2024-01 |
| L12 | The Earth Engine CHIRPS exports reproduce CHC’s own files where both are the same release: for October 2024, the sum of the daily rnl export and the sum of the pentad export each equal CHC’s monthly file chirps-v3.0.2024.10.tif within 0.0001 mm in all 6,674 Java land cells. Checked for one month only |
MEASURED 2026-11-30 | python scripts/check_chirps_chc.py --months 2024-10, CHC file from https://data.chc.ucsb.edu/products/CHIRPS/v3.0/monthly/global/tifs/ |
| L13 | Indonesia’s farm insurance facility (Permentan 30/2023, amended by 36/2025, revoking 40/2015) covers crop failure from natural disaster, pests and climate change (Pasal 4), and a claim follows the farmer’s damage report and an inspection (Pasal 18f): indemnity, not an index. The regulation text names neither AUTP nor a damage threshold; AUTP’s own claim threshold and premium subsidy remain to be cited | CITED 2026-11-30 (read by the Q2 review agent) | https://peraturan.bpk.go.id/Download/320056/Permentan%20Nomor%2030%20Tahun%202023.pdf |
| L14 | Installed on Windows 11 (2026-11-30): PostgreSQL 18.7 (EDB installer; “PostgreSQL 18.7 on x86_64-windows, compiled by msvc-19.44.35230, 64-bit”), service postgresql-x64-18 (Automatic), data directory E:/pgdata/pg18, encoding UTF8, collation English_Indonesia.1252. PostGIS bundle 3.7.0; in database crop_insurance: postgis_full_version() = POSTGIS 3.7.0, GEOS 3.15.1, PROJ 9.8.1 (network off), GDAL 3.13.1, LIBXML 2.12.5, LIBJSON 0.16, LIBPROTOBUF 1.2.1, WAGYU 0.5.0, RASTER. raster2pgsql.exe and shp2pgsql.exe are in the server’s bin. In the climate env: psycopg 3.3.9 with libpq 18.7, geoalchemy2 0.20.0 |
MEASURED 2026-11-30 | python scripts/setup_database.py; python scripts/check_install.py; psql --version |
| L15 | conda-forge has no Windows build of PostGIS: the postgis package (latest 3.7.0) is published for linux-64, linux-aarch64, osx-64 and osx-arm64 only. Its postgresql package for win-64 stops at 9.6.9 |
MEASURED 2026-11-30 | https://api.anaconda.org/package/conda-forge/postgis and .../postgresql, file list by subdir; a conda install ... postgis on win-64 fails with PackagesNotFoundError |
| L16 | PostGIS on Windows is installed with the PostGIS bundle for the EnterpriseDB PostgreSQL distribution (an installer, or Stack Builder > Spatial Extensions; ZIP packages also exist). Bundle 3.7.0 is offered for PostgreSQL 15-19 and includes raster support, MVT support, raster2pgsql, shp2pgsql and pgsql2shp | CITED 2026-11-30 | https://postgis.net/documentation/getting_started/install_windows/ and https://postgis.net/documentation/getting_started/install_windows/released_versions/ |
| L17 | The Java scrape of datanonkom (2026-11-30) has 696,150 rows: 119 kabupaten/kota, each with 5,850 keys (DPI 6 variables x 25 years x 13 months x 2 classes, plus OPT 3 x 25 x 13 x 2), no duplicate keys. All 719,550 table cells of the 200 cached pages, parsed again with an independent parser, equal the CSV | MEASURED 2026-11-30 | python scripts/check_datanonkom.py on the Java scrape of 2026-11-30, section 1; independent parse in temp/verify-datanonkom-2026-11-30/check_raw.py |
| L18 | In the Java scrape, every DPI variable has values from 2016 to 2026 and every OPT variable from 2022 to 2026, for all 119 regions; all earlier years are “-”. Within those years no monthly cell is empty | MEASURED 2026-11-30 | python scripts/check_datanonkom.py on the Java scrape of 2026-11-30, section 2 |
| L19 | In the Java scrape, 94.4% to 96.3% of DPI monthly cells (2016-2026) and 74.3% to 79.4% of OPT monthly cells (2022-2026) are 0.00. December 2026 is 0.00 in all 2,142 monthly cells although the page’s update date is 27 November 2026, so 0.00 also stands for months not reported yet | MEASURED 2026-11-30 | python scripts/check_datanonkom.py on the Java scrape of 2026-11-30, sections 2 and 3 |
| L20 | In the Java scrape, Setahun (annual) equals the sum of months 1-12 within 0.02 ha in all 19,278 groups that have values (19,260 exactly, 17 by 0.01, 1 by 0.02); the 34,272 other groups are empty on both sides | MEASURED 2026-11-30 | python scripts/check_datanonkom.py on the Java scrape of 2026-11-30, section 4 |
| L21 | In the Java scrape, puso (crop failure) exceeds terkena (affected) in 20 of the 125,307 cells that have both, 16 of them in OPT; the largest is Kab. Jepara, OPT Jagung, November 2025: 58.00 ha puso, 18.00 ha terkena | MEASURED 2026-11-30 | python scripts/check_datanonkom.py on the Java scrape of 2026-11-30, section 5 |
| L22 | The province view (vertikal=2) of Jawa Tengah and Jawa Timur, Banjir Padi and Kekeringan Padi, Setahun, 2016, 2019, 2023, 2025 and 2026, terkena and puso, equals the sum of their 35 and 38 kabupaten/kota in the Java scrape in all 40 cells (difference 0.00) |
MEASURED 2026-11-30 | live requests to https://datanonkom.pertanian.go.id/master/iklim/data with vertikal=2&tampilan=2&q=Jawa Tengah (and Jawa Timur); comparison in temp/verify-datanonkom-2026-11-30/cmp_live.txt |
| L23 | The PostGIS 3.7.0 bundle installer (options PROJ_LIB, GDAL_DATA, key GDAL drivers, out-db rasters, SSL bundle) set machine-wide variables: GDAL_DATA and PROJ_LIB pointing into C:\Program Files\PostgreSQL\18, POSTGIS_GDAL_ENABLED_DRIVERS = “GTiff PNG JPEG GIF XYZ DTED USGSDEM AAIGrid”, POSTGIS_ENABLE_OUTDB_RASTERS = 1, CURL_CA_BUNDLE = the bundle’s ca-bundle.crt. A Python started from a conda env without activation then uses the bundle’s PROJ data (pyproj data dir) and its CA bundle (requests). Both proj.db files have layout 1.6 and EPSG v12.029 (PostGIS: PROJ 9.8.1, climate: PROJ 9.7.1) |
MEASURED 2026-11-30 | [Environment]::GetEnvironmentVariable(name, 'Machine') before and after the install; python scripts/check_install.py; metadata table of both proj.db files |
| L24 | The running PostgreSQL service did not see the variables the PostGIS installer had just set: in a new database PostGIS reported “GDAL_DATA not found”, postgis.gdal_enabled_drivers = DISABLE_ALL (0 GDAL drivers) and postgis.enable_outdb_rasters = off. After ALTER DATABASE crop_insurance SET for postgis.gdal_datapath, postgis.gdal_enabled_drivers (the installer’s 8 key drivers) and postgis.enable_outdb_rasters = on, new sessions see 8 drivers including GTiff, and a raster survives ST_AsGDALRaster(..., 'GTiff') and ST_FromGDALRaster with its values (mean 5.5) but with SRID 0 (a fault, not normal behaviour, fixed by restarting the service: see L134). postgis_gdal_version() still prints “GDAL_DATA not found”. Inside the server, ST_Transform of 110 E 7 S to EPSG:32749 gives 389543.5, 9226133.7, the same as pyproj in climate |
MEASURED 2026-11-30 | python scripts/setup_database.py, run before and after the settings were added (its output includes the round trip) |
| L25 | The 2022 boundary layers carry two kabupaten code systems: a2bps (BPS, the codes datanonkom uses, L8) and KDPKAB (“31.71”); the kecamatan layer carries only the second (KDCPUM, “31.71.02”), its a3bps is 0. In Java the two systems differ only for the five cities of DKI Jakarta (KDPKAB 31.71 = BPS 3173 Jakarta Pusat, 31.72 = 3175 Jakarta Utara, 31.73 = 3174 Jakarta Barat, 31.74 = 3171 Jakarta Selatan, 31.75 = 3172 Jakarta Timur). Taking a kecamatan’s kabupaten from the first four digits of KDCPUM put 42 Jakarta kecamatan in the wrong city (under 1% of their area inside it); mapping through KDPKAB leaves 0 |
MEASURED 2026-11-30 | idn_bnd_adm2.shp attributes; python scripts/load_data.py (its point-in-kabupaten check) |
| L26 | Loaded into crop_insurance (2026-11-30): ref.province 6, ref.kabupaten 119, ref.kecamatan 2,146 (left out: two unnumbered Jawa Timur pieces, “35.–.–” 12 ha outside every kabupaten and “35.04.–” 40 ha in Tulungagung). Java area from geography: 13,260,457 ha (provinces), 13,260,359 ha (kabupaten), 13,260,319 ha (kecamatan). Invalid geometries repaired with ST_MakeValid: 1 kabupaten, 14 kecamatan. raw.datanonkom_damage 696,150 rows, ha NULL 445,536, after_update 4,284; sums of ha per topic and class equal the CSV exactly (DPI terkena 3,357,042.33, DPI puso 815,389.26, OPT terkena 1,064,678.79, OPT puso 10,558.95) |
MEASURED 2026-11-30 | python scripts/load_data.py --replace; CSV sums with pandas |
| L27 | CHIRPS v3 (Climate Hazards Center): quasi-global 60 N-60 S, 0.05 degree over land, 1981 to near-present; “CHIRPS is fundamentally a pentad and monthly product, and all other time-steps are derived from those”; the final product blends station inputs once a month, typically in the third week of the following month; licence: CHC’s page states both that CHIRPS3 “is licensed under a Creative Commons Attribution 4.0 International License” and that CHC “has waived all copyright and related or neighboring rights” (“in the public domain”), doi:10.15780/G2JQ0P. The Earth Engine catalog calls the same data “public domain”: the tutorial follows CHC | CITED 2026-11-30 | https://www.chc.ucsb.edu/data/chirps3; https://developers.google.com/earth-engine/datasets/catalog/UCSB-CHC_CHIRPS_V3_DAILY_RNL |
| L28 | CHIRPS v3 daily values split each pentad total by daily ratios from ERA5 (rnl, from 1981) or IMERG Late V07 (sat, from 1998), resampled bilinearly to 0.05 degree; a pentad without ERA5/IMERG rain is divided evenly over its days; days are UTC calendar days. CHC recommends “using pentadal or monthly totals wherever the science allows” and to “test sensitivity with both rnl and sat” |
CITED 2026-11-30 | https://data.chc.ucsb.edu/products/CHIRPS/v3.0/daily/readme.txt |
| L29 | AgERA5 is computed from hourly ERA5 at 0.1 degree, 1979 to present, with days of 00-24 local time (“a shift of 2-3 hours” from true local time in Asia); precipitation (Precipitation-Flux) is not bias-corrected and is interpolated by nearest neighbour; licence CC-BY, doi:10.24381/cds.6c68c9bb | CITED 2026-11-30 | https://cds.climate.copernicus.eu/datasets/sis-agrometeorological-indicators?tab=overview; https://confluence.ecmwf.int/x/4lmaE (Table 1) |
| L30 | Local AgERA5: variable long_name “Total precipitation (00-00LT)”, files generated by pragera5 1.2.0 on 2025-03-10 (version 1.1 or 2.0 not stated); the Indonesia cache’s 2026 file runs 2026-01-01 to 2026-09-01 (244 days) | MEASURED 2026-11-30 | netCDF attributes of E:/temp/agera5/precip/agera5_precip_2016.nc; time axis of E:/temp/xdssat/agera5/idn/RAIN/agera5_idn_RAIN_2026.nc |
| L31 | Cell centres inside the 119 Java kabupaten/kota: AgERA5 0.1 degree: 14 with none, 35 under 4, median 9; CHIRPS 0.05 degree: 2 with none, 18 under 4, median 34 (all units under 4 AgERA5 centres are kota or Kepulauan Seribu). Of 2,146 kecamatan, 1,199 contain no AgERA5 centre and 292 no CHIRPS centre. In Java, January-March 2020, 66% (east-west) and 69% (north-south) of adjacent wet AgERA5 cells hold identical values, 0% for CHIRPS rnl | MEASURED 2026-11-30 | temp/q1-review-2026-11-30/cells.py, cells_kec.py, blocky.py (Q1 review) |
| L32 | CHIRPS rnl and sat give the same pentad, dekad and monthly totals (largest difference 0.000 mm in 105 kabupaten means 2016-2025; 3e-5 mm for one pentad in a 40 x 40 cell window) while their daily values differ (up to 66.8 mm in that window). The local pentad files equal the sum of daily rnl within 3e-5 mm (13 pentads of 2019). January 2019 and January 2023 are each split over two daily files per variant: load by band name (dYYYYMMDD), not by file |
MEASURED 2026-11-30 | temp/q1-review-2026-11-30/compare.py, pentad.py; daily file names |
| L33 | AgERA5 vs CHIRPS rnl over Java 2016-2025 (105 kabupaten, unweighted means of cells with centre inside): mean annual total 2,682 vs 2,828 mm; spatial correlation of mean annual totals 0.63; median correlation over time 0.91 (annual), 0.94 (April-September), 0.81 (October-March), 0.77 (dekad), 0.67 (daily). The two pick the same driest April-September year in 57% of kabupaten | MEASURED 2026-11-30 | temp/q1-review-2026-11-30/extract.py, compare.py, agree.py |
| L34 | Datanonkom drought damage (Kekeringan Padi terkena) cannot tell the products apart: monthly event AUC 0.740 (AgERA5), 0.743 (CHIRPS rnl and sat), 0.741 for one Java-wide series used for every kabupaten; within a month, across kabupaten, 0.531 (AgERA5, 90% bootstrap 0.513-0.551) and 0.534 (CHIRPS, 0.509-0.558). 2019 holds 226,948 of the 619,265 ha of 2016-2025 | MEASURED 2026-11-30 | temp/q1-review-2026-11-30/compare2.py, compare3.py |
| L35 | raw.chirps_rnl_daily holds 16,709 daily rasters, 1981-01-01 to 2026-09-30, one row per day; every year 1981-2025 has a row for each calendar day, 2026 has 273. Each raster is the Java window 105.05-116.30 E, 8.80-5.00 S on the source grid (225 x 76 cells, 0.0500000007 degree, 32BF, nodata -9999), same alignment for all rows; 493 MB in the database. The 42 days exported twice (pilot files) were identical in both copies. Dekad sums computed in SQL (ST_Union(rast, 'SUM')) equal the sum of the two CHC pentad bands within 0.0001 mm in all 6,674 Java land cells for 11 dekads between 1981 and 2025, including the two months split over two files and 21-31 December 2025 |
MEASURED 2026-11-30 | python scripts/prepare_chirps.py; python scripts/load_chirps.py; python scripts/fetch_chirps_cog.py; python scripts/check_chirps_db.py |
| L36 | CHC re-released CHIRPS v3 for late 2025 and 2026: its monthly files for October-December 2025 are dated 2026-11-02, pentads 2026-11-04, daily rnl for 2025-10-01 to 2026-09-30 2026-11-09. Both parts of the local Earth Engine daily export of that period (written 2026-11-02 and 2026-11-11) held the earlier release: compared with CHC’s current daily COGs, every one of the 365 days differed (cells changed by up to 46.1 mm in 2025-10-01 to 2026-01-27 and up to 83.2 mm in 2026-01-28 to 2026-09-30). Summed to months, the old daily export missed CHC’s monthly files for October-December 2025 by 6.6-14.8 mm per cell on average, while the pentad export matched. The 365 days were replaced from CHC (L37); afterwards the daily data matches CHC’s monthly files for October-December 2025 within 0.0002 mm and CHC’s daily file for 2025-12-25 exactly ; CHC’s listing read 2026-12-01 shows the 2026 rnl COGs dated 2026-11-09 (January-April) and 2026-11-10 (May-September), and final rnl extended to 2026-10-31 (October dated 2026-11-13), beyond the series’ record | MEASURED 2026-11-30 | python scripts/check_chirps_chc.py --months 2024-10 2025-10 2025-11 2025-12 --days 2025-12-25 (before and after); E:/temp/pgci/chirps/rnl_java/cog_replacements.csv; CHC directory listings |
| L37 | Reading CHC’s daily rnl cloud-optimized GeoTIFFs (daily/final/rnl/cogs/<YYYY>/*.cog, 7200 x 2400 cells, 512 x 512 tiles, 17-24 MiB each; the 2026 files listed 2026-12-01 are 15.2-25.4 MiB) over HTTP range requests, the Java window of one day costs 2 requests and 393,216 bytes, and its values equal CHC’s full GeoTIFF for that day exactly. The superseded local files are kept in E:/temp/pgci/chirps/rnl_java_superseded/ |
MEASURED 2026-11-30 | one-day test (2025-12-25) with GDAL debug logging; scripts/fetch_chirps_cog.py for 2025-10-01 to 2026-09-30 |
| L38 | Lahan baku sawah 2024 (ATR/BPN) GeoPackage: 1,430,241 polygons, 79% (1,130,094) without any attribute; its LUASHA field sums to 288.8 million ha, impossible for Indonesia, while the attributed 300,147 polygons (Sumatra) sum to 1.76 million ha. The 772,046 polygons whose inside point lies in Java carry no attributes (no irrigation type). Their area from geometry, 3,377,469 ha, equals the official LBS 2024 table for Java (3,377,476 ha in the Banten, DKI, Jabar, Jateng, DIY and Jatim sheets of LBSNASIONAL2024_7.384.341HA.xlsx, national total 7,384,341 ha) and is within 0.3% of it in every kabupaten with over 1,000 ha |
MEASURED 2026-11-30 | attributes read with pyogrio; python scripts/load_paddy.py |
| L39 | Ministry of Agriculture Java rice fields (idn_phy_ricefield_java_{irrigated,rainfed}_moa_a.shp, dated 2015, custom Mercator): 958,206 polygons, 958,169 inside Java kabupaten, 3,391,572 ha from geometry (the files’ HECTARES field: 3,445,492 ha). Irrigated 2,645,336 ha (78.0%: Irigasi Teknis 1,449,425, Semi Teknis 1,026,726, Sederhana 169,185), rainfed (Tadah Hujan) 746,236 ha. Per kabupaten with over 1,000 ha of official LBS 2024, the MoA area is within 10% of LBS 2024 in 42 of 93; the ratio runs from 0.71 (Sumenep) to 1.79 (Kota Surabaya) |
MEASURED 2026-11-30 | python scripts/load_paddy.py; queries on ref.paddy_moa2015 and ref.lbs2024_official |
| L40 | MoA paddy per unit: 3 of 119 kabupaten/kota have none (Kepulauan Seribu, Jakarta Pusat, Jakarta Selatan); 20 have under 1,000 ha (7,429 ha, 0.22% of Java’s 3,391,572 ha), all of them kota or Kepulauan Seribu; all 84 kabupaten have more; median 27,198 ha over the 116 units with paddy. Irrigated share: kabupaten median 0.91; kecamatan 10th, 25th and 50th percentiles 0.03, 0.55 and 1.00; 69 of the 99 units with at least 1,000 ha contain kecamatan under 50% and kecamatan at 90% or more irrigated. Kecamatan: 96 without paddy, 218 under 100 ha (0.12% of paddy) | MEASURED 2026-11-30 | SQL on ref.paddy_moa2015 and ref.kabupaten; temp/q2-review-2026-11-30/paddy_units.py |
| L41 | CHIRPS cells per unit: with cell centre inside the polygon, 292 kecamatan get no cell, 181 of them with at least 100 ha paddy (159,246 ha); weighting by paddy area per cell (each paddy polygon assigned to the cell holding its inside point) leaves none without a cell and puts no paddy in a nodata cell. Paddy-weighted effective number of cells: kecamatan median 3.0 (326 under 2), kabupaten 25.7. Against an exact cell-by-polygon intersection (ST_SquareGrid + ST_Intersection) in 5 kabupaten, the inside-point assignment moves 1.5-3.1% of paddy ha to a neighbouring cell in 4 of 5 kabupaten/kota tested (Indramayu, Garut, Brebes, Malang) and 5.5% in the fifth, Kota Surabaya |
MEASURED 2026-11-30 | temp/q2-review-2026-11-30/coverage.py, exact_vs_point.py |
| L42 | Inside a kabupaten, CHIRPS rnl rainfall barely differs at kecamatan level: April-July totals 1981-2025, paddy-weighted, kecamatan vs own kabupaten correlation median 0.990, 5th percentile 0.957 (1,904 kecamatan with at least 100 ha, 99 kabupaten); dekad anomalies 0.975 and 0.921. With an illustrative 20th-percentile trigger, 8.6% of kecamatan trigger-years fall in years the kabupaten does not trigger (10th percentile: 14.1%; June-September: 9.6%). Lowest correlations in large upland kabupaten (Pandeglang 0.892, Sukabumi 0.900, Cianjur 0.917) | MEASURED 2026-11-30 | temp/q2-review-2026-11-30/hetero.py, hetero_p.py |
| L43 | Against datanonkom drought damage 2016-2025 (990 kabupaten-years, 230 events of terkena above 1% of MoA paddy), a kecamatan index aggregated to kabupaten ranks events no better than the kabupaten index on continuous scores (AUC 0.791 vs 0.792, 90% cluster-bootstrap interval of the difference -0.003 to +0.001); on payouts it scores 0.650 vs 0.591 only because fewer kabupaten-years have tied zero payouts (84% vs 90%) | MEASURED 2026-11-30 | temp/q2-review-2026-11-30/damage_check2.py |
| L44 | SQL cost for one year (2019) of dekad rainfall per unit: ST_Clip + ST_SummaryStats 41.5 s for 119 kabupaten (2 without a cell) and 79.7 s for kecamatan (292 without); a paddy weight table joined to ST_PixelAsPoints 1.8 s and 2.0 s, equal to a numpy computation within 2e-13 mm; building the 36 dekad rasters with ST_Union(rast, 'SUM') 1.4 s. Paddy weighting vs unweighted centre-in changes kabupaten April-July totals by a median 4.2% (largest 57%) but keeps their ranking (r 0.988 or more) |
MEASURED 2026-11-30 | temp/q2-review-2026-11-30/timing2.py, weight_effect.py |
| L45 | ST_Clip selects by default “only … pixels where the center of the pixel is covered”; touched => true selects all pixels that intersect the geometry (added in 3.5.0). ST_SquareGrid (from 3.1.0) builds a square grid anchored at the SRS origin |
CITED 2026-11-30 | https://postgis.net/docs/RT_ST_Clip.html; https://postgis.net/docs/ST_SquareGrid.html |
| L46 | World Bank (2018), parametric drought insurance for Indonesia (technical note, draft January 2018): the index is a 4-month SPI aggregated from 0.5 degree grid cells over Central Java, payouts at province level, validated against district rice production 2006-2015 (district correlations 0.36-0.78; pdf pp. 31, 35, 39, 48) | CITED 2026-11-30 (read by the Q2 review agent) | http://documents.worldbank.org/curated/en/704171524632990898/pdf/Technical-Note.pdf |
| L47 | World Bank (2017), weather index insurance for maize in Eastern Indonesia, feasibility study: prototype contracts at sub-district level around weather stations (pdf p. 8); “In highly spatially heterogeneous production areas, basis risk will likely be so high as to make index insurance problematic” (p. 15); the Ministry of Agriculture rice pilot in West and Central Java was multi-peril indemnity insurance (p. 37) | CITED 2026-11-30 (read by the Q2 review agent) | http://documents.worldbank.org/curated/en/261291490700705164/pdf/113760-WP-WII-for-Maize-Production-in-Eastern-Indonesia-PUBLIC.pdf |
| L48 | Index inputs in schema idx (2026-11-30): 99 insured units holding 3,384,143 ha (99.78% of MoA paddy); paddy weights in 7,002 unit x regime x cell rows summing to 3,391,572.1 ha, equal to the paddy layer, with 0 ha outside the raster or in nodata cells; 1,647 complete dekads 1981-01-01 to 2026-09-30; 531,981 rows of paddy-weighted dekad rainfall, 1,647 dekads for every insured unit; 103 MB; built in about 2 minutes. Recomputed outside the database (shapely inside points, rasterio, numpy) for 5 kabupaten x 5 dekads x 3 regimes, the 75 values agree within 0.0000046 mm | MEASURED 2026-11-30 | python scripts/build_index_inputs.py; python scripts/check_dekad_rain.py |
| L49 | Timing of reported damage in the 99 insured units, 2016-2025: Kekeringan Padi (drought) terkena 619,140 ha, 88.5% in April-September (84.6% without 2019; puso 96.7%); by month May 23.8%, June 26.6%, July 15.7%, August 11.4%, September 7.5%. Banjir Padi (flood) terkena 88.0% in October-March. DI Yogyakarta is the exception (40% of its drought damage in April-September). Drought terkena per 1,000 ha paddy per year: 22 ha in units under 50% irrigated (15 units), 19 ha at 50-90% (38), 17 ha at 90% or more (46) | MEASURED 2026-11-30 | SQL on raw.datanonkom_damage and idx.insured_unit; temp/q4-review-2026-11-30/m1_damage_months.py |
| L50 | Wet-season onset by the BMKG rule (first of 3 consecutive dekads with at least 50 mm, L55) on paddy-weighted CHIRPS dekads of the 99 insured units, searching 1 August to end of February, 1991-2020: onset found in 2,950 of 2,970 unit-years (20 without); unit medians 11 October (10th percentile, percentile_disc), 11 November (median), 1 December (90th); within a unit the year-to-year interquartile range is a median 3.8 dekads; 12.6% of unit-years start in August-September (mostly 2010, 2016, 1998). Same onset dekad as this rule: 72% at 40 mm, 71% at 60 mm, 94% searching from 1 September, 10% for a 150 mm cumulative rule. The Java median agrees within a dekad with xdssat’s AgERA5 onset (1 November) |
MEASURED 2026-11-30 | SQL window query on idx.dekad_rain (under 1 s); temp/q4-review-2026-11-30/m3_onset.py |
| L51 | Dry dekads (1991-2020 mean under 50 mm) per insured unit: median 17, from 0 (Pangandaran) and 1 (Bogor) to 25 (Situbondo); 95-98 of 99 units are dry from 11 June to 11 September. Dry-season onset (the BMKG rule reversed), unit medians 1 May (10th percentile), 11 May (median), 11 June (90th); by province Jawa Timur and DIY 1 May, Jawa Tengah 21 May, Jawa Barat and Banten 1 June | MEASURED 2026-11-30 | temp/q4-review-2026-11-30/m2_clim.py, m10_dso_prov.py |
| L52 | MK1 drought windows (9 dekads) scored against April-September drought events 2016-2025 (n 987, 228 events of terkena above 1% of paddy): pooled AUC 0.763 fixed 1 April, 0.706 climatological wet onset + 14 dekads, 0.686 that year’s onset + 14 dekads, 0.810 climatological dry-season onset - 2 dekads (year-block bootstrap 90% interval of the difference to fixed 1 April: 0.001 to 0.083); within-year AUC 0.47-0.53 for all four. The last anchor was proposed after seeing the damage timing, so its edge is a hypothesis, not a hold-out result | MEASURED 2026-11-30 | temp/q4-review-2026-11-30/m6b_link_pct.py, m11_anchorD.py, m12_overlap.py |
| L53 | MoA intens_09 repeats the regime: all irrigated paddy (2,645,336 ha) is “2x padi/th” or “2 x Padi/Thn”, all rainfed (746,236 ha) “1x padi/th” or “1 x Padi/Thn”. BDSP harvested area divided by MoA paddy area, 99 units: median 1.93 in 2012-2017 and 1.59 in 2018-2025 (Java 1.94 and 1.61); harvested area drops from 6.96 Mha (2017) to 5.71 Mha (2018), probably BPS’s change of survey method (VERIFY) |
MEASURED 2026-11-30 | SQL on ref.paddy_moa2015; temp/q4-review-2026-11-30/m4_intensity.py |
| L54 | GGCMI phase 3 crop calendar (CC BY 4.0) over Java: source RiceAtlas in all 81 0.5 degree cells; main rice season planted 25 October to 10 December, 110 days; second season planted 10 May in 70 of 81 cells, 110-120 days; irrigated and rainfed values identical | CITED and MEASURED 2026-11-30 | https://zenodo.org/records/5062513; temp/q4-review-2026-11-30/m7_ggcmi.py |
| L55 | BMKG defines the onset of the rainy season as the first of three consecutive dasarian (dekads) with at least 50 mm each; the onset of the dry season is the reverse | CITED 2026-11-30 | Giarno, Dupe and Mustofa (2012), Jurnal Meteorologi dan Geofisika 13(1), p. 2, doi:10.31172/jmg.v13i1.113, https://jmg.bmkg.go.id/jmg/index.php/jmg/article/view/113 |
| L56 | A 120-day tropical rice variety spends about 60 days in the vegetative, 30 in the reproductive and 30 in the ripening phase; differences in growth duration come mainly from the vegetative phase | CITED 2026-11-30 | Yoshida (1981), Fundamentals of Rice Crop Science, IRRI, pp. 1-3, http://books.irri.org/9711040522_content.pdf |
| L57 | FAO-56 Table 11 gives rice (tropics, planted December or May) stage lengths of 30, 30, 60 and 30 days (150 days), “indicative of general conditions” | CITED 2026-11-30 | https://www.fao.org/4/X0490E/x0490e0b.htm |
| L58 | Published calendars for Java checked 2026-11-30: RiceAtlas is CC0 1.0 but every file sits behind a Dataverse guestbook form (not filled in); KATAM Terpadu hosts did not resolve or respond; BMKG’s season-forecast pages offer no historical onset per ZOM for download. Not yet known: whether datanonkom’s month is the month of damage or of report; growth durations of Java varieties (Ciherang, IR 64, Inpari 32) | VERIFY | https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/JE6R2R |
| L59 | Crop calendar in schema idx (2026-12-01, decision Q4): 99 units x 2 seasons. MH onset (BMKG rule, search 1 September to 21 February, 1991-2020) found in all but 20 of 2,970 unit-years; unit medians 21 September (earliest), 11 October (10th percentile), 11 November (median), 1 December (90th), 21 December (latest); MH transplanting 1 December at the median unit. Dry-season onset found in all but 115 unit-years (at least 21 of 30 per unit); unit medians 1 April to 11 June, median 11 May; MK1 transplanting 11 April (10th percentile), 21 April (median), 21 May (latest). The clamp (MK1 not before the dekad after MH harvest) moves MK1 in 6 units (Banyuwangi, Kota Pasuruan, Kota Probolinggo, Kota Serang, Probolinggo, Situbondo); free dekads between MH harvest and MK1 transplanting: 1 to 12, median 4, 8 or more in 32 units (Jawa Barat 16, Jawa Tengah 13, Banten 3; 12 in Bogor; 10-11 in Lebak, Pandeglang, Kota Tasikmalaya, Cianjur, Pangandaran); at least 4 between MK1 harvest and the next MH. idx.season_dekad: 90,130 rows, crop years 1980-2025, complete seasons only, every dekad has dekad rain. Recomputed in plain Python: 198 of 198 calendar rows and 990 of 990 sampled season-years identical | MEASURED 2026-12-01 | python scripts/build_crop_calendar.py; python scripts/check_crop_calendar.py |
| L60 | Season dekad rain, regime ‘all’, dekads 1991-2020: MK1 reproductive stage median 11.2 mm, mean 29.4 mm, 48.2% of dekads under 10 mm; MK1 season rain median per unit 320 mm (10th-90th percentile 260-410), 7 of 99 units with a median of at least 450 mm. MH season rain 1981-2025: 2 unit-seasons under 450 mm (minimum 412 mm), 96.6% at least 700 mm | MEASURED 2026-12-01 | temp/q5-review-2026-12-01/q1_clim.py, q7_need.py, my_check.py |
| L61 | In MK1 (crop years 1981-2025, within-unit percentiles) the candidate drought indices rank seasons almost alike: Spearman with season rain 0.93 (deficit below the 1991-2020 dekad mean), 0.95 (deficit below 50 mm per dekad), 0.94 (bucket, 50 mm demand, 100 mm capacity), 0.84 (dekads under 10 mm), 0.75 (longest run of such dekads). Share of zero values: dry-dekad count MK1 14.2%, MH 92.0%; bucket 18.9% and 99.6%; deficit below the mean MK1 2.3%. All built in one SQL statement in about 6 s | MEASURED 2026-12-01 | temp/q5-review-2026-12-01/q2_index_sql.py, q4_detail.py, my_check.py |
| L62 | MK1 drought indices against drought terkena above 1% of unit paddy in April-September, damage years 2016-2025 (n 990, 230 events in 9 years; 66 in 2019): pooled / within-year AUC 0.808 / 0.530 season rain, 0.821 / 0.565 deficit below the dekad mean (average of stage percentiles), 0.761 / 0.506 reproductive stage only; a Java-wide series (same value for every unit in a year) scores 0.806. All paired differences to season rain have 90% year-block bootstrap intervals spanning 0 except bucket and reproductive-only (worse). Rain of ‘all’, ‘irrigated’ or ‘rainfed’ paddy is interchangeable (Spearman 0.993). About 180 AUCs were computed, so the best within-year value is not evidence of skill | MEASURED 2026-12-01 | temp/q5-review-2026-12-01/q3_score.py, q4_detail.py, q5_more.py; recomputed in my_check.py (0.809 / 0.527, 0.822 / 0.566, 0.806) |
| L63 | Stage weighting against MK1 drought damage: reproductive-weighted (1:2:1) minus equal stage percentiles -0.037 to 0.009 pooled AUC; a worst-stage index (maximum of the three stage percentiles) minus the equal average -0.117 to -0.041 pooled, -0.183 to -0.057 within-year (90% year-block intervals). Share of the mean deficit below normal by stage: MK1 vegetative 47%, reproductive 32%, ripening 21%; MH 41%, 32%, 27% | MEASURED 2026-12-01 | temp/q5-review-2026-12-01/q4_detail.py, q6_stage_share.py |
| L64 | MH drought damage 2016-2024 crop years: 20 terkena events above 1% of paddy in 5 crop years (7 in 2019, 8 in 2023), 101 puso events in 7 crop years | MEASURED 2026-12-01 | temp/q5-review-2026-12-01/q3_score.py |
| L65 | FAO Irrigation Water Management manual 3, Table 14: rice (paddy) needs 450-700 mm per growing period, drought sensitivity “high”, given as a rough estimate; section 4.4: percolation 4-8 mm per day, saturation 200 mm, water layer 100 mm | CITED 2026-12-01 | https://www.fao.org/4/s2022e/s2022e07.htm, https://www.fao.org/4/s2022e/s2022e08.htm |
| L66 | FAO-56 Table 12: rice crop coefficients Kc ini 1.05, mid 1.20, end 0.90-0.60 | CITED 2026-12-01 | https://www.fao.org/4/X0490E/x0490e0b.htm |
| L67 | PostgreSQL 18, section 4.2.8: only window functions that are aggregates accept a FILTER clause; with ORDER BY the default frame is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW | CITED 2026-12-01 | https://www.postgresql.org/docs/18/sql-expressions.html |
| L68 | Not yet sourced: rice is most sensitive to water deficit in the reproductive stage (FAO-33, FAO-66, Yoshida 1981 chapters on water; PDFs, not fetched); BMKG “sifat hujan” thresholds (85% and 115% of normal; pages returned 404); that dry-season rain tracks irrigation supply in Java | VERIFY | |
| L69 | idx.season_index (2026-12-01, decision Q5): 35,640 rows, 99 units x 2 seasons x 45 crop years (1981-2025) x 4 (three stages and the season), built in 1.5 s. Mean normal and mean deficit below normal per season: MH 1,136 mm and 194 mm, MK1 357 mm and 135 mm; by MK1 stage, normal 197 / 92 / 68 mm and deficit 62.5 / 42.8 / 29.4 mm (vegetative / reproductive / ripening); seasons with zero deficit MH 0.1%, MK1 2.1%. Recomputed in plain Python: all 35,640 rows, largest difference 4.5e-13 mm. The built MK1 equal-weight index scores pooled AUC 0.821, within-year 0.564 against drought terkena above 1% (n 990, 230 events), as in the review (L62) | MEASURED 2026-12-01 | python scripts/build_season_index.py; python scripts/check_season_index.py; temp/q5-review-2026-12-01/q5_built_auc.py |
| L70 | The equal-weight index (mean of three stage ranks) is not uniform: pooled 80th percentile 0.742 in MK1 and 0.659 in MH; 12.1% (MK1) and 5.5% (MH) of seasons reach 0.8, 0.58% of MK1 seasons reach 0.95; MK1 stage-rank Spearman 0.37-0.55, MH 0.04-0.08. Fixed cut-offs therefore do not give the intended return periods; thresholds must be percentiles of the index itself. Per-unit 1-in-5 season deficits: MK1 108-506 mm (49-70% of normal), MH 186-590 mm (19-33%) | MEASURED 2026-12-01 | temp/q6-review-2026-12-01/m1_scale.py |
| L71 | Trends 1981-2025: MK1 season deficit, 0 of 99 units with Kendall p < 0.05, Java Theil-Sen slope -1.47 points of normal per decade (95% interval -6.24 to 3.55); MH, 18 of 99 units wetter at p < 0.05 (about 5 expected by chance, field significance not tested), Java Kendall tau -0.141, p 0.171. The damage decade is wet: Java MK1 deficit share 0.307 in crop years 2015-2024 vs 0.386 in 1991-2020 | MEASURED 2026-12-01 | temp/q6-review-2026-12-01/m2_trend.py |
| L72 | Reference period of thresholds (1-in-5 trigger, 1-in-20 exit) vs 1981-2025: 1991-2020 changes trigger status in 2.4-4.4% of unit-years, 1981-2014 in 2.2-3.1%, leave-one-year-out in 1.3-1.8%. Sampling noise is larger: bootstrap 90% width of the 1-in-5 trigger from 30 years is a median 28% (MK1) and 36% (MH) of its value | MEASURED 2026-12-01 | temp/q6-review-2026-12-01/m3_ref.py |
| L73 | Stage ranks from percent_rank() over the whole record drift: rebuilding with the record ending 2025 instead of 2024 moved all 99 triggers in both seasons (up to 0.017) and changed the payout of 430 (MK1) and 491 (MH) of 4,356 past unit-seasons (up to 0.444 of the sum insured). Ranks against 1991-2020 only (hypothetical-set percent_rank(x) WITHIN GROUP) do not drift, and the SQL equals Python on 26,730 rows in 1.6 s |
MEASURED 2026-12-01 | temp/q6-review-2026-12-01/m8_drift.py, m9_sql_fixedrank.py |
| L74 | Contract with 1991-2020 stage ranks, trigger = unit’s 1991-2020 80th percentile (1-in-5), exit = 95th (1-in-20), linear payout: payout frequency 1981-2025 MK1 0.176, MH 0.194 (updated 2026-12-02 after the exact index, L166); Java pure premium (paddy-weighted mean payout) MK1 0.119, MH 0.123; MK1 exit minus trigger median 0.109 (minimum 0.038, 8 units under 0.05). MK1 pays in clusters: no unit pays in 24 of 45 crop years, at least 50 units in 7; worst crop year 1993 (dry season 1994) 94 units, 0.85 of the total sum insured, 69 units at 100%. MH worst crop year 1997, 0.64. Review figures with whole-record ranks are within 0.005 (0.116, 92 units, 0.84) | MEASURED 2026-12-01 | temp/q6-review-2026-12-01/my_check.py; temp/q6-review-2026-12-01/m4_payout.py, m7_detail.py |
| L75 | That contract against MK1 drought terkena above 1% of paddy, crop years 2015-2024 (n 990, 230 events): it triggers in 3 crop years only (2017: 36 units, 2018: 51, 2022: 10); hit rate 0.270, false alarm rate 0.046, 36% of its 97 payouts without a recorded event. A basis-risk test of a 1-in-5 trigger rests on about 2 trigger years | MEASURED 2026-12-01 | temp/q6-review-2026-12-01/my_check.py; temp/q6-review-2026-12-01/m5_damagefit.py |
| L76 | A Java-wide MK1 trigger level fitted on damage (5 years fit, 5 scored, all 252 splits): median 0.67 by frequency matching (range 0.40-0.76), 0.56 by Youden J; fit on 2015-2019 gives 0.73, on 2020-2024 0.63. Fitted levels pay more often (frequency 0.305 and 0.417 vs 0.173 for 0.80; pure premium 0.183 and 0.239 vs 0.115) and 41-52% of fitted payouts have no recorded event | MEASURED 2026-12-01 | temp/q6-review-2026-12-01/m5_damagefit.py, m5b_damagefit.py |
| L77 | MH seasons that trigger have median season rain 887 mm (10th-90th percentile 664-1,174); 85% have at least 700 mm. MH and MK1 pay in the same unit-year in 2.9% of unit-years (3.3% if independent) | MEASURED 2026-12-01 | temp/q6-review-2026-12-01/m7_detail.py, m4_payout.py |
| L78 | WMO recommends 1991-2020 as the standard climatological reference period (announced 5 May 2021); PostgreSQL 18: ordered-set and hypothetical-set aggregates accept FILTER but cannot be used as window functions; SQL functions may use a RETURN body |
CITED 2026-12-01 | https://wmo.int/media/news/updated-30-year-reference-period-reflects-changing-climate, https://www.postgresql.org/docs/18/sql-expressions.html, https://www.postgresql.org/docs/18/functions-aggregate.html, https://www.postgresql.org/docs/18/sql-createfunction.html |
| L79 | Not yet sourced: sum insured per ha (lead: datanonkom /master/harga/gabah-provinsi, unchecked); trigger and exit return periods used in index-insurance practice (WMO-No. 1203, World Bank technical note, IRI 2009: PDFs, not fetched) | VERIFY | |
| L80 | Q6 built (2026-12-01): idx.season_index rebuilt with stage ranks against crop years 1991-2020 (hypothetical-set percent_rank(x) WITHIN GROUP, a self-join on the 30 reference seasons; 35,640 rows in 5.5 s; plain Python equal on every row, largest difference 4.5e-13 mm, ranks 0). idx.payout (linear, IMMUTABLE STRICT), idx.contract (198 rows; trigger = 1991-2020 80th percentile of the equal-weight index, MK1 0.620-0.780, MH 0.558-0.702; exit = 95th, MK1 0.751-0.896, MH 0.685-0.862; exit minus trigger median MK1 0.109, MH 0.138, under 0.05 in 8 MK1 and 1 MH units; sum insured NULL) and out.payout (8,910 rows, 1981-2025). Payout frequency MK1 0.176, MH 0.194 (updated 2026-12-02 after the exact index, L166); Java pure premium MK1 0.119, MH 0.123; largest crop year MK1 1993 (94 units, 69 at 100%, 0.845 of the Java sum insured), MH 1997 (77 units, 0.642); crop years with no unit paying MK1 24, MH 2 of 45. Python recomputation of thresholds and payouts: differences 0. Drift: the index rebuilt with the record ending 2024 changes 0 of 34,848 index rows, 0 thresholds and 0 payouts (whole-record ranks: 921, L73) |
MEASURED 2026-12-01 | python scripts/build_season_index.py; python scripts/check_season_index.py; python scripts/build_contract.py; python scripts/check_contract.py |
| L81 | Q6 contract (MK1) against drought terkena above 1% of MoA paddy, summed over the unit’s MK1 season months plus 1 month (from idx.season_dekad), crop years 2015-2024: n 990, 226 events in 9 crop years, 97 payouts in 3; hits 62, misses 164, false alarms 35, quiet 729. P(no payout given loss) 0.726, P(no loss given payout) 0.361 (n 97), P(payout given no loss) 0.046 (n 764); 0.794 of payout ha-equivalents go to loss unit-seasons; 0.268 of terkena ha lies in paid unit-seasons. P(payout given loss) cannot exceed 97/226 = 0.43 in this wet decade (L71). Index AUC 0.826 pooled, 0.571 mean within-year. Recomputed independently: all equal |
MEASURED 2026-12-01 | temp/q7-review-2026-12-01/m6_uncertainty.py, m7_sql.py; temp/q7-review-2026-12-01/my_check.py |
| L82 | Loss class and threshold (same window): puso above 1% 83 events in 8 years, P(pay given loss) 0.325, P(no loss given pay) 0.722; terkena above 0.1% / 2% / 5%: 413 / 162 / 73 events, P(pay given loss) 0.201 / 0.315 / 0.370, P(no loss given pay) 0.144 / 0.474 / 0.722 | MEASURED 2026-12-01 | temp/q7-review-2026-12-01/m1_contingency.py |
| L83 | Matching window (MK1, terkena above 1%): fixed April-September 230 events, P(pay given loss) 0.270, AUC 0.820 / 0.562 (pooled / within-year); season months + 0 / + 1 / + 2 months: 203 / 226 / 236 events, 0.300 / 0.274 / 0.271, AUC 0.833-0.823 pooled, 0.557-0.571 within-year. Both window families were shaped after seeing damage timing (L49, L52) | MEASURED 2026-12-01 | temp/q7-review-2026-12-01/m4_window.py |
| L84 | Uncertainty, year-block bootstrap (crop years resampled, 5,000): P(pay given loss) 90% interval 0.024-0.427 (my check 0.024-0.424), P(no loss given pay) 0.235-0.700 (undefined in 2.6% of replicates), payout share to loss 0.520-0.882. Permutation p: year labels about 0.001; units within year 0.045 for P(pay given loss), 0.003 payout share, 0.66 damage share (my check 0.659). The contract paid in the two worst reported drought years (crop years 2017, 2018), lightly in 2022 (3 hits of 28 events) and not in 2023 (92,974 ha terkena, 31 events, 0 payouts) | MEASURED 2026-12-01 | temp/q7-review-2026-12-01/m6_uncertainty.py; temp/q7-review-2026-12-01/my_check.py |
| L85 | BDSP rice for the 99 units: 12-40 years each, 76 units from 1986, 41 complete to 2025, 47 with gaps (2000 for most of Jawa Barat); Java harvested area 6.963 Mha (2017) to 5.714 Mha (2018), cause not sourced. PRODUKTIVITAS is 0 in 255 of 990 unit-years 2016-2025 (2016-2022) where area and production are positive: derive yield as production / area | MEASURED 2026-12-01 | temp/q7-review-2026-12-01/m2_bdsp_coverage.py; temp/q7-review-2026-12-01/my_check2.py |
| L86 | BDSP is not a usable second loss signal. Yield anomaly vs annual drought terkena above 1%, 2016-2025: AUC 0.499 (review; median-based 0.484), 0.541-0.578 in my four anomaly definitions; harvested area 0.596-0.649 (review 0.631, puso 0.701). MK1 index vs the unit’s worst 20% detrended yield years, harvest years 1987-2015 (15 trigger years): AUC 0.446 (review), 0.450 (mine, n 2,408), low-yield share 0.141 in paid years vs 0.216 overall. So BDSP cannot extend the basis-risk test before 2016, and the Q4 follow-up on yields is unlikely to inform | MEASURED 2026-12-01 | temp/q7-review-2026-12-01/m3_bdsp_signal.py, m8_denominator_q10.py; temp/q7-review-2026-12-01/my_check.py, my_check2.py |
| L87 | Other perils in the same windows: MK1 crop years 2015-2024 flood terkena 92,585 ha vs drought 541,882 ha (57 vs 226 events), 1 of 97 payouts with a flood event, drought-or-flood loss gives P(pay given loss) 0.228 (n 272); MH crop years 2016-2024 flood 659,922 ha vs drought 29,043 ha (11 drought events in 3 years); MH crop year 2015 starts before the DPI record. MK1 pests (OPT, crop years 2021-2024, n 396): 175,982 ha vs drought 134,257 ha, 37 of 61 drought events also have a pest event | MEASURED 2026-12-01 | temp/q7-review-2026-12-01/m5_flood_opt_zero.py, m9_edges.py |
| L88 | Zeros and denominators: 101 of 990 MK1 unit-years have no positive DPI report of any kind; 8 units silent in at least 5 of 10 years; 5 kota never report drought; excluding silent unit-years moves P(pay given loss) 0.274 to 0.274 and P(no loss given pay) 0.361 to 0.340. BDSP harvested area / MoA paddy 0.70-2.49 (5th-95th percentile, median 1.64); event sets at BDSP 0.55% vs MoA 1% overlap with Jaccard 0.941. Puso above terkena (Q10) in 3 drought and 1 flood cell of the insured units, none changes an event (correction 2026-12-01: the flood cell is Banjir Jagung, not rice, L107) | MEASURED 2026-12-01 | temp/q7-review-2026-12-01/m5_flood_opt_zero.py, m8_denominator_q10.py, m9_edges.py |
| L89 | MK1 crop year 2025 (damage 2026, provisional: datanonkom to November 2026, CHIRPS July-September 2026 may be re-released, L36): 40 payouts, 21 events, 14 hits, 26 false alarms, P(pay given loss) 0.667, P(no loss given pay) 0.650, within-year AUC 0.775. Recomputed independently: equal | MEASURED 2026-12-01 | temp/q7-review-2026-12-01/m10_cy2025.py; temp/q7-review-2026-12-01/my_check.py |
| L90 | The basis-risk table in SQL (damage pivot with sum() FILTER, season window as daterange, <@ join, avg(paid::int) FILTER (WHERE loss_event), GROUPING SETS, year-block bootstrap with setseed, generate_series, random() and percentile_cont(ARRAY[...])) equals pandas within 2.3e-13 on 990 MK1 rows; built in 0.60 s, 2,000 bootstrap replicates in 0.44 s |
MEASURED 2026-12-01 | temp/q7-review-2026-12-01/m7_sql.py |
| L91 | Clarke (2016), AEJ: Microeconomics 8(1): 283-306: basis risk makes index insurance demand differ from indemnity insurance; demand is zero for infinitely risk-averse buyers (abstract) | CITED 2026-12-01 | https://www.aeaweb.org/articles?id=10.1257/mic.20140103 |
| L92 | Not yet sourced: Kementan definitions of terkena and puso (is puso a subset of terkena, what damage share counts, are months new or standing area; candidates Permentan 39/2018, L113, and the Ditlin TP OPT/DPI juknis, not fetched); the loss-without-payout argument in Clarke’s full text (PDF, not fetched); the cause of the 2018 BPS harvested-area break | VERIFY | |
| L93 | Q7 built (2026-12-01): views out.basis_risk (2,083 unit-season-years whose damage window, season months + 1 month, lies inside January 2016 to November 2026; MK1 crop years 2015-2025, MH 2016-2025 plus 4 units of MH 2015; crop year 2025 flagged provisional) and out.basis_risk_summary (Java and province rows by GROUPING SETS, non-provisional). MK1 Java: n 990, losses 226, payouts 97 in 3 crop years, hits 62, P(pay given loss) 0.274, P(no loss given pay) 0.361, P(pay given no loss) 0.046, payout share to loss 0.794, damage share paid 0.268, ceiling 0.429. MH Java: n 895, 11 losses, 95 payouts, P(no loss given pay) 0.937 (updated 2026-12-02 after the exact index, L166). MK1 by province, P(pay given loss): Jawa Barat 0.269 (n 93), Jawa Tengah 0.292 (72), Jawa Timur 0.171 (35), Banten 0.333 (21), DI Yogyakarta 0.600 (5). Windows with no positive rice drought or flood report: MK1 302 of 990, MH 184 of 895. Plain Python recomputation: all rows equal (damage within 2.3e-13 ha, rates within 2.2e-16) |
MEASURED 2026-12-01 | python scripts/build_basis_risk.py; python scripts/check_basis_risk.py |
| L94 | Back-test by period, payout frequency / Java pure premium (paddy-weighted mean payout), 90% year-block intervals for the long periods. MK1: 1991-2020 reference 0.190 / 0.131; 1981-1990 0.170 / 0.114; 2021-2024 0.025 / 0.008 (10 of 396 unit-seasons, all crop year 2022); final record 1981-2024 0.171 (0.107-0.237) / 0.116 (0.068-0.171); crop year 2025 0.404 / 0.262. MH: 0.193 / 0.130; 0.210 / 0.111; 0.174 / 0.101; 0.195 (0.146-0.250) / 0.123 (0.085-0.165); 0.162 / 0.138 (intervals from the bootstrap with a fixed draw order, L169) (updated 2026-12-02 after the exact index, L166). MK1 2021-2024 minus reference frequency -0.167 (90% -0.265 to -0.077, review before L166), the only one of 16 contrasts (chosen after looking) whose interval excludes 0. L74 and L80 quote 1981-2025 (MK1 0.176 / 0.119). Point values recomputed independently: equal | MEASURED 2026-12-01 | temp/q8-review-2026-12-01/m1_period.py, m6_sql.py; temp/q8-review-2026-12-01/my_check.py |
| L95 | Within 1991-2020 the contract pays in exactly 6 of 30 crop years in 80 of 99 MK1 units (82 MH) and in full in exactly 2 in 89 (91): in-reference frequency and premium restate the 80th / 95th percentile rule, they are not evidence | MEASURED 2026-12-01 | temp/q8-review-2026-12-01/m1_period.py |
| L96 | MK1 1981-2025: the top 1 / 3 / 5 crop years hold 0.158 / 0.413 / 0.587 of payout ha-equivalents; premium 0.119 (90% 0.070-0.174), 0.103 without 1993, 0.075 without the worst 3; per unit the median 90% interval is 1.22 times the unit’s premium; 78-87% of MK1 index variance is Java-wide | MEASURED 2026-12-01 | temp/q8-review-2026-12-01/m1_period.py, m3_early.py |
| L97 | Crop year 2025 is complete in rainfall: all 198 seasons have 10 dekads; MH from the dekad of 2025-10-11 to that of 2026-04-11, MK1 from 2026-04-01 to the dekad of 2026-08-21 (CHIRPS to 2026-09-30); every 2025 season lies inside CHC’s re-released block 2025-10-01..2026-09-30 (L36) | MEASURED 2026-12-01 | temp/q8-review-2026-12-01/m4a_window2025.py |
| L98 | CHC’s re-release moved crop year 2025 payouts (superseded local GeoTIFFs vs current; no downloads): MK1 40 units paid vs 36 before, 4 status changes, 17 changed by more than 0.01 (max 0.570), Java premium 0.262 vs 0.248; MH 16 vs 17 paid, 1 status change, 6 changed by more than 0.01 (max 0.265), premium 0.138 vs 0.134; unit dekad rain mean absolute change 4.24 mm (max 48.6). Recomputed independently: equal (current release equals out.payout within 3e-15) | MEASURED 2026-12-01 | temp/q8-review-2026-12-01/m4b_rerelease.py; temp/q8-review-2026-12-01/my_check.py |
| L99 | Stage deficits of zero-rain stages (8 in the record) can tie exactly with reference years (e.g. Kota Bandung MK1 reproductive 1982, 2011, 2014, 2025), so a strict below-count rank depends on floating-point summation order. In the stored idx.season_index no stage rank changes when ranked with a 1e-9 tolerance (0 of 26,730); Python checks should still rank with that tolerance | MEASURED 2026-12-01 | temp/q8-review-2026-12-01/m4g_tie.py, m4h_zero_stage.py; temp/q8-review-2026-12-01/my_check.py |
| L100 | NCAR Climate Data Guide, CHIRPS v3 (modified 2025-12-11): GridSat IR before 2000 in place of CPC IR may introduce characteristics inconsistent with the rest of the record; changing station density can cause spurious trends; early-1980s satellite gaps, especially over Africa | CITED 2026-12-01 | https://climatedataguide.ucar.edu/climate-data/chirps-climate-hazards-infrared-precipitation-station-data-version-3 |
| L101 | CHIRPS v3 station counts for Indonesia over time exist only as PNG charts on CHC’s diagnostics server (not fetched) | VERIFY | https://data.chc.ucsb.edu/products/CHIRPS/v3.0/diagnostics/ |
| L102 | Java CHIRPS dekads: grid roughness (mean neighbour difference / mean, Nov-Mar, driest Java-mean quartile) 0.116 in 1981-1990 and 0.109 in 1991-1999 vs 0.085-0.088 after 2000 (same step in other quartiles); unit anomaly correlation 0.488 in 1981-1990 vs 0.549-0.574 later; MH Java-wide index variance share 0.217 vs 0.37-0.47, MK1 unchanged. Not re-checked independently | MEASURED 2026-12-01 | temp/q8-review-2026-12-01/m3_early.py |
| L103 | Payout frequency by decade (1981-90, 91-00, 01-10, 11-20, 21-24): MK1 0.170 / 0.191 / 0.229 / 0.151 / 0.025, MH 0.210 / 0.299 / 0.198 / 0.082 / 0.174 (updated 2026-12-02 after the exact index, L166); the Kendall figures below are from before L166. Kendall tau of the yearly Java frequency 1981-2024: MH -0.235, p 0.025 (review) or -0.255, p 0.016 (my scipy run); MK1 no trend (p 0.85 review, 0.61 mine). 25 of 99 units’ MH index wetter at p < 0.05, MK1 none; serial correlation and field significance not tested | MEASURED 2026-12-01 | temp/q8-review-2026-12-01/m2_decade.py; temp/q8-review-2026-12-01/my_check.py |
| L104 | Java premium 1981-2025 under MoA 2015 / LBS 2024 / equal unit weights: MK1 0.119 / 0.120 / 0.119, MH 0.123 / 0.123 / 0.121; per-unit LBS/MoA hectare ratio median 0.97 (5-95% 0.58-1.28). The back-test is as-if: today’s contract and 2015 paddy on past weather | MEASURED 2026-12-01 | temp/q8-review-2026-12-01/m5_exposure.py |
| L105 | A back-test summary in SQL (int4multirange periods joined with @>, a provisional flag from each season’s last dekad against a final-through date, ordered array_agg, array slices, year-block bootstrap with setseed, generate_series, LATERAL, percentile_cont(ARRAY[...])) equals pandas within 1e-12 on 12 season-periods; 0.13 s, bootstrap 2,000 x 12 in 1.29 s |
MEASURED 2026-12-01 | temp/q8-review-2026-12-01/m6_sql.py |
| L106 | Q8 built (2026-12-01): idx.data_status (chirps_rnl: 1981-01-01, available to 2026-09-30, final to 2025-09-30; datanonkom_dpi: 2016-01-01, 2026-11-30, 2025-12-31; edit by hand, views read it), out.payout.season_end, Q7 views now read data_status (same 2,083 rows and flags), idx.backtest_period (int4multirange, open upper bounds), views out.backtest_year, out.backtest_summary, function out.backtest_bootstrap(replicates, seed). Provisional: MH and MK1 crop year 2025 (99 units each). Final record 1981-2024, frequency / pure premium (90% year-block, 2,000): MK1 0.171 (0.107-0.237) / 0.116 (0.068-0.171), MH 0.195 (0.146-0.250) / 0.123 (0.085-0.165); reference 1991-2020 MK1 0.190 / 0.131, MH 0.193 / 0.130; out-of-reference (14 years) MK1 0.128 (0.036-0.242) / 0.083, MH 0.200 / 0.108; 2021-2024 MK1 0.025 / 0.008, MH 0.174 / 0.101 (updated 2026-12-02 after the exact index, L166); provisional 2025 MK1 0.404 / 0.262, MH 0.162 / 0.138. Worst crop years MK1 1993 (0.845), MH 1997 (0.642); top 3 years hold 0.434 (MK1) and 0.304 (MH) of 1981-2024 payout. Plain Python: all rows equal (within 2.2e-16); bootstrap bounds within 0.007 of numpy for periods of 10+ years, and equal to exact enumeration (inverted CDF) for the 4-year periods. Summary and bootstrap run in 1.3 s |
MEASURED 2026-12-01 | python scripts/build_contract.py; python scripts/build_basis_risk.py; python scripts/build_backtest.py; python scripts/check_backtest.py, check_basis_risk.py, check_contract.py |
| L107 | L21 by category: 20 cells = 18 monthly + 2 Setahun; OPT 16 (Padi 3, Jagung 10, Kedelai 3), DPI 4 (Kekeringan Padi 3, Banjir Jagung 1); terkena = 0 in 4, none rice. Rice cells in the 99 insured units: Kekeringan Padi Purworejo 2024-09, Temanggung 2024-08, Kendal 2024-08 (terkena 0.6-1.0, puso 1.0-5.0 ha); OPT Padi Kebumen 2026-07, Demak 2026-10. The Lamongan 2025-02 DPI cell is Banjir Jagung (variabel 9: terkena 3.90, puso 4.00 ha), so there are 0 rice flood cells (corrects L88). Lamongan recomputed independently | MEASURED 2026-12-01 | temp/q10-review-2026-12-01/m1_cells.py; temp/q10-review-2026-12-01/my_check.py |
| L108 | Insured units, 2016-2025: puso at most the same month’s terkena in 861 of 864 rice drought months with puso > 0, 1,406 of 1,406 rice flood months, 448 of 448 OPT Padi months (2022-2025); no month with puso > 0 and terkena = 0; Setahun puso > terkena in 0 of 376 / 622 drought / flood groups with puso. Correlation of puso with terkena the same month / one month earlier: drought 0.715 / 0.250, flood 0.743 / 0.147. Monthly values behave as flows: 28.3% of month-to-month drought terkena steps go down, Setahun = sum of months (L20). Subset counts recomputed independently | MEASURED 2026-12-01 | temp/q10-review-2026-12-01/m2_timing.py; temp/q10-review-2026-12-01/my_check.py |
| L109 | Of the 18 monthly puso > terkena cells, 15 follow positive terkena in the 3 months before (the 3 rice drought cells: 20.06, 2.0 and 21 ha the month before); 13 hold puso <= terkena over that month plus the 3 before and 16 over the calendar year (exceptions: Trenggalek Jagung 2023, Boyolali Kedelai 2022, likely entry errors). Revisions cannot be tested: one vintage, source_update 27 November 2026 on all rows |
MEASURED 2026-12-01 | temp/q10-review-2026-12-01/m0_schema.py, m1_cells.py |
| L110 | Q10 rules on out.basis_risk: summed puso exceeds summed terkena in 0 of 2,083 windows (drought or flood); flagged months fall in 2 windows (Temanggung and Kendal, MK1 crop year 2023). Keep, cap per month (least), cap per window, drop and raise terkena give identical events, hits and rates for every season, province and status (MK1 final: 226 losses, 62 hits; puso above 1% 83 events, 27 hits; above 0.1% 198, 51; MH 11 losses, 6 hits); only Jawa Tengah MK1 hectares move (month cap: drought puso 142,746.58 to 142,742.18 ha in final windows; drop: -1.80 terkena, -6.20 puso). Recomputed independently: equal |
MEASURED 2026-12-01 | temp/q10-review-2026-12-01/m3_rules.py; temp/q10-review-2026-12-01/my_check.py |
| L111 | Plausibility, insured units, rice: Setahun = sum of months within 0.02 ha (2,673 groups); no negative values; no month, year or window above paddy_ha (window maxima: drought 0.303 of paddy, Kota Cilegon MK1 2018; flood 0.301, Purworejo MK1 2015). Pacitan January 2016 drought terkena 10,989 ha (0.569 of paddy); Java January 2016 20,996 ha in 10 units vs at most 5,797 in other Januaries (backlog or 2015 El Nino, not separable); it lies in no scored window except 4 MH 2015 windows, none a loss | MEASURED 2026-12-01 | temp/q10-review-2026-12-01/m4_plaus.py, m5_extreme.py, m6_jan2016.py |
| L112 | A flag column (count(*) FILTER (WHERE puso > terkena) per window) and a build assertion (0 windows with summed puso above terkena), run as a TEMP view, equal out.basis_risk on all 2,083 rows and 12 columns; a lag() listing of puso > terkena months with the previous month runs in 0.56 s |
MEASURED 2026-12-01 | temp/q10-review-2026-12-01/m7_sql.py |
| L113 | Permentan 39/PERMENTAN/HM.130/8/2018 on early warning and handling of climate-change impacts (DPI) in agriculture, in force 1 January 2019, 8 pages: likely primary source for DPI reporting; text not read (PDF not fetched), so whether it defines terkena and puso is unknown | CITED 2026-12-01 (metadata only) | https://peraturan.bpk.go.id/Details/161032/permentan-no-39permentanhm13082018-tahun-2018 |
| L114 | Q10 built (2026-12-01): damage values kept as published; out.basis_risk gains puso_gt_terkena_months (window months with rice puso above terkena); scripts/build_basis_risk.py stops if any window’s summed puso exceeds its summed terkena (0 of 2,083) and lists the flagged months with the month before (lag()): Purworejo 2024-09 (terkena 0.60, puso 1.00; month before 20.06 / 4.96), Temanggung 2024-08 (0.80 / 1.20; 2.00 / 0.80), Kendal 2024-08 (1.00 / 5.00; 21.00 / 8.00). Flagged windows: Temanggung and Kendal MK1 2023/24; Purworejo 2024-09 falls between its MK1 and MH windows. Plain Python: flag column, window check and all earlier columns equal on 2,083 rows |
MEASURED 2026-12-01 | python scripts/build_basis_risk.py; python scripts/check_basis_risk.py |
| L115 | Rice flood vs drought damage, 99 insured units, 2016-2025: terkena 861,354 vs 619,140 ha (1.39 times), puso 206,593 vs 148,331 ha (puso / terkena 0.240 both); flood terkena per 1,000 ha paddy per year Banten 40.4, Jawa Tengah 31.0, Jawa Barat 27.5, DI Yogyakarta 20.6, Jawa Timur 16.3 (DIY the only province where drought is larger); 62% in December-February; flood above drought in 62 of 99 units; top calendar year 0.140 and top 3 years 0.409 of flood terkena (drought 0.367 and 0.724); top 10 units 0.482 (drought 0.532). Totals recomputed independently: equal | MEASURED 2026-12-01 | temp/q9-review-2026-12-01/m1_size.py, my_check.py; temp/q9-review-2026-12-01/my_check_main.py |
| L116 | Flood terkena by season window (months + 1): MH 0.807, MK1 0.096, both 0.012, none 0.086 (mostly October-November before MH transplanting). MH final rows: 324 flood events (terkena above 1% of paddy) of n 895, 28-45 per crop year 2016-2024; above 5%: 79; puso above 1%: 76. MK1: 57 events. 26 of the 95 MH drought payouts (96 before L166) coincide with a flood event. 324 recomputed independently | MEASURED 2026-12-01 | temp/q9-review-2026-12-01/m1b_windows.py; temp/q9-review-2026-12-01/my_check_main.py |
| L117 | Chronic flood reporting: 26 units have an MH flood event in at least 6 of 9 crop years 2016-2024, holding 190 of 323 events and 0.746 of MH-window flood terkena; 29 units have none; a 1-in-5 relative trigger paying 2 of 9 years could reach at most P(pay given loss) 0.393. By irrigated share (< 50%, 50-90%, >= 90%; 15 / 38 / 46 units): flood 12.0 / 20.4 / 33.5 ha per 1,000 ha per year, drought 22 / 19 / 17, MH event rate 0.170 / 0.330 / 0.452; Spearman with irrigated share flood +0.238, drought -0.237 (ecological: units mix regimes and irrigated share goes with lowland location). Chronic counts recomputed independently: equal | MEASURED 2026-12-01 | temp/q9-review-2026-12-01/m7_chronic.py, m1_size.py; temp/q9-review-2026-12-01/my_check_main.py |
| L118 | No local rain index sees MH flood events: 17 local, 0.5-degree neighbourhood and Java-wide excess-rain indices (season excess, dekads above the 90th percentile, maximum dekad, Rx1day, Rx5day, days >= 50 mm, wettest pentad, stage and window variants) score pooled AUC 0.497-0.550 and within-year (2016-2024) 0.488-0.534 as 1991-2020 ranks, 0.536-0.561 as raw mm; unit flood event rate vs mean Rx5day Spearman 0.082. MK1 pooled 0.69-0.75 but a Java-wide series scores 0.735 (a year signal). About 70 AUCs computed. My independent run: raw Rx5day pooled 0.561, within-year 0.554; MH season rain 0.543 / 0.518 | MEASURED 2026-12-01 | temp/q9-review-2026-12-01/m3_indices.py, m4_score.py, m8_dekad_only.py, m9_raw.py, m10_within.py; temp/q9-review-2026-12-01/my_check_main.py |
| L119 | An MH flood contract built like the drought one (Rx5day, 1991-2020 trigger 1-in-5, exit 1-in-20): 244 payouts in 9 crop years, 87 hits on n 895, P(no payout given loss) 0.731 (90% 0.666-0.788) vs 0.727 for random payouts of the same count, P(no loss given payout) 0.643 vs 0.638; excess mm, Rx1day and dekads above p90 likewise near random; 1981-2024 frequency 0.237, Java pure premium 0.144; with the MH drought contract both pay in 3.1% of unit-seasons (4.6% if independent), combined premium 0.267, 0.254 capped at 1. My independent run: 246 payouts, 88 hits, 0.728 vs random 0.725 | MEASURED 2026-12-01 | temp/q9-review-2026-12-01/m5_contract.py, m10_within.py, my_check.py; temp/q9-review-2026-12-01/my_check_main.py |
| L120 | Daily paddy-weighted rain for the 99 units from raw.chirps_rnl_daily (ST_PixelAsPoints joined to the weights): 1981-2026 in 242 s (one weight set, my run; review 485 s with two); its dekad sums equal idx.dekad_rain within 3.2e-5 mm (both runs). Rx5day by a ROWS BETWEEN 4 PRECEDING window: 0.10 s for one season-year, equal to pandas within 2e-13; the per-pixel route (5-day ST_Union(rast, 'SUM'), pixel maxima, then weighting) 251 s and Rx5day ratio median 1.01; a Java maximum raster with ST_Union(rast, 'MAX') 0.32 s |
MEASURED 2026-12-01 | temp/q9-review-2026-12-01/m2_daily.py, m6_sql.py; temp/q9-review-2026-12-01/my_check_main.py |
| L121 | CHC CHIRPS v3 daily readme: daily extremes are pentadal amounts redistributed by ERA5 or IMERG, not independent station-based daily extremes; pentadal or monthly totals are recommended, and rnl and sat should be compared | CITED 2026-12-01 | https://data.chc.ucsb.edu/products/CHIRPS/v3.0/daily/readme.txt |
| L122 | PostgreSQL 18: RANGE frame offsets take an interval for date columns, ROWS offsets count rows; any ordinary aggregate can be a window function. PostGIS: ST_Union raster union types LAST (default), FIRST, MIN, MAX, COUNT, SUM, MEAN, RANGE; ST_MapAlgebra expression form from 2.1.0 |
CITED 2026-12-01 | https://www.postgresql.org/docs/18/sql-expressions.html, https://www.postgresql.org/docs/18/functions-window.html, https://postgis.net/docs/RT_ST_Union.html, https://postgis.net/docs/RT_ST_MapAlgebra_expr.html |
| L123 | IWMI index-based flood insurance (IBFI): flood thresholds predetermined from modelling and satellite imagery with other data; pilots in Bihar and Bangladesh 2015-2018; the page names no specific index variable | CITED 2026-12-01 | https://ibfi.iwmi.org/ |
| L124 | Not yet sourced: Java paddy floods are mainly river overflow, plus tidal flooding and subsidence on the north coast (e.g. Demak, Pekalongan, Pati); the project has no river network, DEM or discharge data to test it | VERIFY | |
| L125 | Transplanting dates of idx.crop_calendar (one fixed date per unit and season, 2026-12-01): MH from the dekad of 11 October to that of 11 January (transplant_k 7-16), median unit 1 December; 4 of 99 units transplant MH in January of the next calendar year. MK1 from the dekad of 1 April to that of 21 May (transplant_k 24-29), median unit 21 April; every MK1 season ends by 31 August (its last dekad starts 21 August at the latest). Example: crop year 2017 holds MH transplanted 11 October 2017 to 11 January 2018 and MK1 transplanted 1 April to 21 May 2018 | MEASURED 2026-12-01 | SQL on idx.crop_calendar (min, max, percentile_disc of transplant_k) and idx.season_dekad (crop year 2017) |
| L126 | PostgreSQL 18 password file (libpq): one line per connection, hostname:port:database:username:password; each of the first four fields can be a literal or *, which matches anything, and the first matching line is used. On Microsoft Windows the file is %APPDATA%.conf and no permission check is made; on Unix it is ~/.pgpass and is ignored unless group and world access are disallowed (e.g. chmod 0600). PGPASSFILE (or the passfile parameter) points to another file; a colon or backslash inside an entry (e.g. in the password) is escaped with a backslash | CITED 2026-12-01 | https://www.postgresql.org/docs/18/libpq-pgpass.html |
| L127 | PostgreSQL 18: CREATE DATABASE cannot be executed inside a transaction block, and its synopsis has no IF NOT EXISTS clause; ALTER DATABASE … SET makes the value the session default for sessions started later in that database; a database contains one or more named schemas, which in turn contain tables | CITED 2026-12-01 | https://www.postgresql.org/docs/18/sql-createdatabase.html, https://www.postgresql.org/docs/18/sql-alterdatabase.html, https://www.postgresql.org/docs/18/ddl-schemas.html |
| L128 | In the climate env (numpy 2.5.4, Python 3.14.10, Windows 11), a 200 x 200 matrix product (numpy @) ends the process with exit code 127 and no message unless MKL_THREADING_LAYER=SEQUENTIAL is set; with it set, the same product runs (exit 0) | MEASURED 2026-12-01 | python -c with and without the variable in Git Bash |
| L129 | PostGIS: raster support became a separate extension in 3.0.0 (release notes, Breaking Changes, ticket 3888); PostGIS provides geometry for planar and geography for geodetic coordinates, and raster storage, analysis, loading and export | CITED 2026-12-01 (read by the claims-auditor agent) | https://postgis.net/docs/manual-3.0/release_notes.html, https://postgis.net/docs/postgis_introduction.html |
| L130 | psycopg 3: by default the first statement on a connection starts a transaction and later statements run inside it until commit or rollback; with autocommit no transaction is started; with psycopg.connect(...) as conn commits at the end of the block and rolls back on an exception. sql.Identifier escapes names with double quotes; composing SQL by string formatting is a security problem when names come from untrusted input; values that cannot be bound (e.g. in SET) go through sql.Literal |
CITED 2026-12-01 (read by the claims-auditor and sql-reviewer agents) | https://www.psycopg.org/psycopg3/docs/basic/transactions.html, https://www.psycopg.org/psycopg3/docs/api/sql.html, https://www.psycopg.org/psycopg3/docs/basic/from_pg2.html |
| L131 | PostGIS raster settings: postgis.gdal_enabled_drivers is DISABLE_ALL and postgis.enable_outdb_rasters is False in a standard installation; the environment variables POSTGIS_GDAL_ENABLED_DRIVERS and POSTGIS_ENABLE_OUTDB_RASTERS only set initial values; with DISABLE_ALL, out-db rasters, ST_FromGDALRaster, ST_AsGDALRaster, ST_AsTIFF, ST_AsJPEG and ST_AsPNG raise errors; even with out-db on, the driver list decides which formats are readable; postgis.gdal_datapath sets GDAL’s GDAL_DATA, and the GDAL_DATA environment variable is used if it is not set. The pages give no security reason for the defaults. The settings can only be changed by a superuser (context superuser in pg_settings) |
CITED 2026-12-01 (pages read by web-fetch and sql-reviewer agents; context measured by sql-reviewer) | https://postgis.net/docs/postgis_gdal_enabled_drivers.html, https://postgis.net/docs/postgis_enable_outdb_rasters.html, https://postgis.net/docs/postgis_gdal_datapath.html, https://postgis.net/docs/RT_ST_GDALDrivers.html |
| L132 | PostGIS ST_Area: for geography the area is computed on a spheroid by default, in square metres (use_spheroid = false uses a sphere). For the 0.01 x 0.01 degree cell at 110 E, 7 S: 1,221,962.44 m2 on the spheroid, 1,219,232.63 m2 on the sphere | CITED 2026-12-01; values MEASURED by the sql-reviewer agent | https://postgis.net/docs/ST_Area.html |
| L133 | PostgreSQL 18: initialising a cluster creates the databases template1, template0 and postgres; postgres is meant as a default database for users and applications to connect to and can be dropped and recreated; PL/pgSQL is installed by default since 9.0; CREATE DATABASE copies template1 unless told otherwise, and encoding and locale must match the template except when template0 is used | CITED 2026-12-01 (read by the claims-auditor and sql-reviewer agents) | https://www.postgresql.org/docs/18/manage-ag-templatedbs.html, https://www.postgresql.org/docs/18/plpgsql-overview.html, https://www.postgresql.org/docs/18/sql-createdatabase.html |
| L134 | The point 110 E, 7 S lies in Kab. Batang (BPS 3325), Jawa Tengah. Transformed from EPSG:4326 to EPSG:4211 (Batavia, a datum used in Java), PostGIS and pyproj both give 109.99890164 E, 7.00025357 S, a shift of about 120 m, so the server reads PROJ’s datum parameters. pyproj in the climate env runs PROJ 9.7.1 with its own data directory (PROJ_LIB unset in the shell used); PostGIS runs PROJ 9.8.1 (L14). The GeoTIFF bytes written by ST_AsGDALRaster carry EPSG:4326 (rasterio reads them so), but ST_FromGDALRaster reads them back with SRID 0 on this server, which has run since 2026-11-30 17:56 (before the PostGIS installer’s machine-wide PROJ_LIB was set, L23) and prints GDAL_DATA not found (L24): GDAL inside the server cannot resolve the EPSG code. After the user restarted the service (2026-12-01 13:08:54 +07:00), the same round trip returns SRID 4326, postgis_full_version() no longer prints GDAL_DATA not found, and Chapter 2 runs with every test passing |
MEASURED 2026-12-01 | SQL and pyproj/rasterio in the climate env; pg_postmaster_start_time(); sql-reviewer agent’s reading of PostGIS 3.7 source (rtpg_utility.c, rt_util.c) |
| L135 | With postgis.enable_outdb_rasters on, a plain SELECT using ST_AddBand with a file path made the server open a CHIRPS GeoTIFF on its disk and read 6,653 pixels: out-db lets any role that can run SELECT read files the service account can open, in the enabled formats. No table of the series uses out-db bands (raster_columns out_db false for raw.chirps_rnl_daily; load_chirps.py has no -R) |
MEASURED 2026-12-01 (sql-reviewer agent) | read-only SQL in the climate env |
| L136 | postgis.net Getting Started lists install instructions for Docker, macOS, OpenSUSE and SUSE, Red Hat / CentOS / Scientific Linux, Ubuntu / Debian, and Windows | CITED 2026-12-01 | https://postgis.net/documentation/getting_started/ |
| L137 | The web map “Batas Wilayah Administrasi Kab/Kota - Kel/Desa” (snippet “Batas Wilayah Administrasi”) on BIG’s geoservices portal is a public Web AppBuilder application, owner Direktorat_PBNR01, created 2022-11-26, modified 2026-11-11; its description, access information and licence fields are empty. The series author names Badan Informasi Geospasial (BIG) as the source of the boundary layer and this map as where it is available (user, 2026-12-01) | CITED 2026-12-01 (item metadata read by a web-fetch agent; the web app’s HTML shows no content) | https://geoservices.big.go.id/portal/apps/webappviewer/index.html?id=49bda2cefd3f4b92aa726300bcdb40f7, https://geoservices.big.go.id/portal/sharing/rest/content/items/49bda2cefd3f4b92aa726300bcdb40f7?f=json |
| L138 | BPS WebGIS “Kode Relasi” (“Cari Relasi Kode Wilayah”): a lookup relating BPS codes (Wilayah Kerja Statistik) to Kemendagri codes (Wilayah Administrasi, KDN) for provinsi, kabupaten/kota and kecamatan, by data period; search by BPS code or name and by PUM code or name; results as a table. No licence or terms stated on the page | CITED 2026-12-01 (read by a web-fetch agent) | https://sig.bps.go.id/kode-relasi |
| L139 | The boundary file of the series, java_kabupaten_big2022.parquet (GeoParquet, zstd, 38.9 MB, sha256 c3ef890a…cf6a1): the 121 features of provinces 31-36 from the author’s BIG adm2 layer (idn_bnd_adm2.shp, METADATA field TASWIL5000020220921KABKOTA for every feature, EPSG:4326), Z dropped, columns province_code and province_name (a1bps, a1name), code (a2bps, BPS), name, type, code_kemendagri (a2siak); BPS and Kemendagri codes added by the series author. The source’s type field is 20 characters wide (C(20)), and Kepulauan Seribu’s value is stored as the literal “Kabupaten Administr*“. 119 features carry a code; two Jawa Timur pieces have code 0 and no name or type; 120 of 121 are valid. In the author’s layer each Java province (adm1) equals the union of its kabupaten/kota: symmetric difference 0.0000% of the province area for all six |
MEASURED 2026-12-01 | scratchpad make_bnd.py and bnd_size2.py (shapely/geopandas in the climate env) |
| L140 | RFC 9309 (Robots Exclusion Protocol, Standards Track, September 2022): crawlers MUST support * (0 or more of any character) and $ (end of pattern); the most specific (longest) matching rule MUST be used, allow winning a tie; a 4xx robots.txt means everything may be fetched, a 5xx means assume complete disallow; a crawler MAY cache robots.txt and SHOULD NOT use the cached copy for more than 24 hours. Python’s urllib.robotparser documentation refers to RFC 9309 for the file’s structure and says nothing about * or $. Measured: in Python 3.14.10, robotparser on datanonkom’s rules (L3) answers allowed for /master/iklim/data and disallowed for /master/iklim/export, /cari/x and /login |
CITED 2026-12-01 (read by a web-fetch agent); behaviour MEASURED 2026-12-01 | https://www.rfc-editor.org/rfc/rfc9309.html, https://docs.python.org/3/library/urllib.robotparser.html; Chapter 3 section 7 and a scratch test in the climate env |
| L141 | The Java scrape of datanonkom fetched 200 pages (100 search terms x 2 topics), 536 MB, between 2026-11-30 10:25:48 and 10:48:24 UTC (23 minutes), with scripts/scrape_datanonkom.py and a 5 s pause counted from the start of each request; 536 MB is the decoded HTML (the sidecars’ bytes). On disk the cache holds 8.47 MB of gzipped pages and 0.18 MB of JSON sidecars |
MEASURED 2026-12-01 | access times and sizes in the cache’s JSON sidecars, E:/temp/pgci/datanonkom/java/raw/*.json |
| L142 | BPS (a1bps, a2bps) and Kemendagri (a1siak, a2siak) codes in the author’s BIG 2022 layers: provinces differ in 6 of 38, all six Papua provinces (e.g. Papua 94 vs 91); kabupaten/kota differ in 199 of the 514 with a code, in 29 provinces; in Java 114 of 119 are equal, the five DKI Jakarta cities differ. The kecamatan layer has a3bps 0 in all 7,304 features, so the systems cannot be compared there | MEASURED 2026-12-01 | scratchpad codes_cmp.py on E:/temp/idn-bnd/idn_bnd_adm{1,2,3}.shp |
| L143 | Licence or terms for redistributing the BIG boundary layer (the series ships a Java extract, L139): none stated in the item metadata (L137) | VERIFY | ask BIG or find its data terms; the series author decided to publish the extract (2026-12-01) |
| L144 | Chapter 3 run on a fresh database (crop_insurance_book) against the scripts’ tables in crop_insurance: ref.kabupaten identical (119 rows; code, name, type, province code, geography area and geometry bytes equal; code_kemendagri equals the scripts’ code_pum); raw.datanonkom_damage identical (696,150 rows, same md5 over all columns); ref.province equal for five provinces, Jawa Timur 98.07 ha smaller in the chapter, which unions only the 119 coded kabupaten/kota and so leaves out the two unnamed pieces (85.76 and 12.31 ha) | MEASURED 2026-12-01 | scratchpad cmp_book.py; Chapter 3 output |
| L145 | On the datanonkom data page the export link points to https://datanonkom.pertanian.go.id/master/iklim/data/export (with the page’s query), which the robots rule /*/export (L3) disallows; Python 3.14.10 robotparser answers disallowed for it. The q search matches parts of names: q=Blitar returns 3505 Kab. Blitar and 3572 Kota Blitar, q=Bandung 3204, 3217 and 3273, q=Banjar 3279 and 3304 |
MEASURED 2026-12-01 | href in the cached q=Indramayu DPI page; cached pages and E:/temp/pgci/datanonkom/java_run.log (claims-auditor agent) |
| L146 | At 110 E, 7 S, 0.005 degree of longitude is 552 m and 0.005 degree of latitude 553 m (geography distance). Simplified with ST_CoverageSimplify(geometry, 0.005) OVER (), the 119 kabupaten/kota keep 16,731 of 2,900,220 vertices (0.28 MB of WKB instead of 46.4 MB) |
MEASURED 2026-12-01 | SQL on crop_insurance_book (scratchpad m3.py, draw_bytes.py) |
| L147 | The Java window of CHIRPS v3.0 daily rnl for 2019-01-15 and 1985-06-01, read from CHC’s daily COGs over HTTP range requests, equals the series’ file (from the Earth Engine export, L10) exactly in all 6,674 land cells (largest difference 0.0 mm) and has the same land mask; CHC’s COG has no nodata value set and stores the sea as -9999, the same value as the series’ files. CHC’s grid: 0.05000000074505806 degree, top-left corner 180 W, 60 N; the Java window starts at column 5701, row 1300 | MEASURED 2026-12-01 | scratchpad chc_test.py (rasterio /vsicurl in the climate env); https://data.chc.ucsb.edu/products/CHIRPS/v3.0/daily/final/rnl/cogs/ |
| L148 | The CHIRPS files of the series: 46 GeoTIFFs chirps-v3.0-rnl-java-<year>.tif, 1981-2026, one band per day named dYYYYMMDD (365 or 366 bands; 2026: 273, to 2026-09-30), 225 x 76 cells, float32, nodata -9999, deflate, 385.4 MB in all, with source, licence (CC BY 4.0), area and units in the tags; checksums in checksums/chirps-v3.0-rnl-java.sha256. Stacked from the daily Java GeoTIFFs of prepare_chirps.py, with 2025-10-01..2026-09-30 from CHC’s re-released COGs (fetch_chirps_cog.py, L36-L37). Loaded with raster2pgsql, one day of 2019 at a time, the rasters are byte-identical to raw.chirps_rnl_daily of the scripts (3 days compared); splitting a 365-band raster with ST_Band in SQL costs about 33 ms per band (12 s per year), because each call decodes the whole raster |
MEASURED 2026-12-01 | scratchpad make_chirps_release.py, r2p_test.py, split_test2.py |
| L149 | ST_Union(rast, 'SUM') without an order adds the days in the order the rows are read: Chapter 4’s idx.chirps_dekad (crop_insurance_book) differs from the scripts’ (crop_insurance) by up to 0.00024 mm in 1,464 of 1,647 dekads, same nodata mask, while the daily rasters are byte-identical (md5 over all 16,709 days). With ST_Union(rast, 'SUM' ORDER BY day) both databases give byte-identical dekads (1995-10-11 tested); ORDER BY day DESC gives a different result. The scripts’ idx tables were built before ORDER BY was added to build_index_inputs.py; Chapter 4’s final build (with ORDER BY) differs from them by at most 0.00018 mm in 1,092 dekads |
MEASURED 2026-12-01 | scratchpad cmp_book4.py, cmp_dekad.py, orderby_test.py |
| L150 | The CHIRPS Java window (105.05-116.30 E, 8.80-5.00 S) has 6,674 land cells; 4,329 have their centre inside a Java province (ref.province), and 1,413 lie more than 0.05 degree from Java, 339 of them in the Lampung (Sumatra) corner and 514 east of 114.3 E (Bali, Lombok) | MEASURED 2026-12-01 | ST_PixelAsCentroids of 2019-01-15 against ref.province on crop_insurance_book (scratchpad java_cells.py); distances by the sql-reviewer agent |
| L151 | raster2pgsql 3.7.0: by default its SQL opens with BEGIN; and ends with END;, one INSERT per file; -e writes the statements without them; -F fills filename with the file’s base name; --help says rasters that are entirely nodata are skipped unless -k is given. Without the bundle’s PROJ data (PROJ_DATA/PROJ_LIB set to share/contrib/postgis-3.7/proj) it warns “Cannot find proj.db” and writes the same SQL. Loading one year from a yearly file (unpack 365 single-band GeoTIFFs, raster2pgsql, insert) takes about 12 s on the author’s computer, most of it outside the database |
MEASURED 2026-12-01 | scratchpad r2p_test.py, r2p_e_test.py; claims-auditor and sql-reviewer agents (audit4/r2p_tail.py, time_unpack*.py, time_ingest.py) |
| L152 | AddRasterConstraints in PostGIS 3.7.0: the default call adds 11 enforce_*_rast constraints (srid, scale x and y, width, height, same alignment, number of bands, pixel types, nodata values, out-db, maximum extent); a constraint that cannot be added raises a WARNING and is skipped while the function still returns true; the positional call AddRasterConstraints('raw', 'chirps_rnl_daily', 'rast') resolves to the (table, column, VARIADIC constraints) version, i.e. table raw, column chirps_rnl_daily |
MEASURED 2026-12-01 (pg_constraint, the function’s source and EXPLAIN VERBOSE, by the claims-auditor and sql-reviewer agents) | https://postgis.net/docs/RT_AddRasterConstraints.html; read-only SQL on crop_insurance_book |
| L153 | CHIRPS pentads: CHC’s page gives the preliminary pentads as available 2 days after the end of a pentad, “on the 2nd, 7th, 12th, 17th, 22nd and 27th day of each month”, so pentads end on the 5th, 10th, 15th, 20th, 25th and the last day of the month and each dekad is two pentads. ST_Union(rast, 'SUM') (PostGIS 3.7.0) skips nodata inputs (5[nodata] + 3 + 2[nodata] = 3 on synthetic 32BF rasters; a cell is nodata only if every input is), keeps the running total as a 32-bit float (a dekad equals a float32 running sum in day order in all 6,674 cells), and has no combine function, so it cannot run in parallel |
CITED 2026-12-01 (CHC page read by the claims-auditor agent); MEASURED 2026-12-01 (sql-reviewer and claims-auditor agents) | https://www.chc.ucsb.edu/data/chirps3; ro_checks3.py, f32_check.py in the scratchpad |
| L154 | The paddy files of the series: moa-ricefield-java-2015-irrigated.parquet (568,025 polygons, 501.4 MB) and moa-ricefield-java-2015-rainfed.parquet (390,181 polygons, 440.4 MB), GeoParquet (zstd) written from the author’s idn_phy_ricefield_java_{irrigated,rainfed}_moa_a.shp (metadata title idn_phy_ricefield_java_highres_moa_a) with the columns OBJECTID, KODE_BPS, IRIGASI_09, INTENS_09, PRODUK_09, HECTARES and the geometry unchanged: 2D Polygon or MultiPolygon in a custom Mercator projection (WGS 84, central meridian 90, false northing 1,500,000 m, standard parallel 0) that has no EPSG code; checksums in checksums/moa-ricefield-java-2015.sha256. No licence or terms appear with the data: the GeoParquet metadata holds only the keys pandas, geo (CRS as PROJJSON, GeoParquet 1.1.0) and ARROW:schema, and the shapefiles’ .shp.xml has only the template text “REQUIRED: Restrictions and legal prerequisites…” in its access and use constraint fields |
MEASURED 2026-12-01 | scratchpad make_paddy_release.py; the shapefiles’ .prj and .shp.xml |
| L155 | Licence or terms for redistributing the Ministry of Agriculture Java rice-field layer (the series ships it, L154): none recorded with the files | VERIFY | ask the Ministry of Agriculture; the series author decided to publish the files (2026-12-01) |
| L156 | In the MoA paddy files (L154) OBJECTID is not unique: 412,828 of 568,025 irrigated and 227,322 of 390,181 rainfed rows share their id with another row (184,756 and 97,859 ids), and rows sharing an id differ in attributes and geometry (e.g. OBJECTID 1 is a field with KODE_BPS 3301 and another with 3203). The HECTARES field equals each polygon’s area on the file’s custom Mercator plane (largest relative difference 5e-12, both files): Java total 3,445,627 ha on the plane; on the spheroid the 958,169 fields inside Java hold 3,391,572 ha (L39). For Kab. Indramayu’s irrigated fields (KODE_BPS 3212, 15,814), the Mercator plane gives 113,176 ha and an equal-area projection (EPSG:6933) 111,759 ha, 1.3% less | MEASURED 2026-12-01 | scratchpad paddy_facts.py; Chapter 5 section 3 |
| L157 | Assigning the 958,169 MoA fields to kabupaten/kota by ST_Intersects(k.geometry, ST_PointOnSurface(s.geometry)) against ref.kabupaten (2,900,220 vertices, L146) took 1,494 s for the whole CREATE TABLE step on the author’s computer (repair 35 s of it); against ST_Subdivide(geometry, 256) pieces of the same kabupaten/kota (25,013 pieces, 16 s to build and index) the join took 61 s and matched every field exactly once. Chapter 5’s ref.paddy_moa2015 equals the scripts’ table (same 958,169 geometries, attributes and areas, md5); its idx.insured_unit equals the scripts’ except that 12 units without rainfed paddy have rainfed_ha 0.0 instead of NULL |
MEASURED 2026-12-01 | Chapter 5 run on crop_insurance_book; scratchpad subdiv_test.py, cmp_book5.py, unit_diff.py |
| L158 | MoA paddy facts for Chapter 5 (crop_insurance_book, 2026-12-01): 10,944 fields cross a kabupaten/kota boundary, with 5,833 ha (0.17% of 3,391,572 ha) outside the unit of their inside point, up to 107.8 ha for one field, 276 fields over 5 ha; of the 15,496 fields whose KODE_BPS differs from the unit by location (32,060 ha), 926 (2,208 ha) carry code 0 and 4,951 (17,243 ha) carry 3207 (Ciamis) but lie in 3218 (Pangandaran); 67,201 fields (278,401 ha) have their centroid outside the field. ST_Transform(geom, from_proj text, 4326) (PostGIS 3.7.0) accepts the file’s projection as text and agrees with geopandas/pyproj to 1-2 ulp, but takes 18.9 s (PROJ string) or 260 s (WKT) per 20,000 fields, against 34 s for all 958,206 in geopandas. Python memory (climate env, Windows peak working set): reading one file whole and reprojecting it 6.3 GB, both files 7.6 GB; reading the irrigated file in batches of 50,000 rows and reprojecting each 1.84 GB in 25 s |
MEASURED 2026-12-01 | claims-auditor agent (audit5/q1.py, q2.py), sql-reviewer agent (sqlrev/proj.py), scratchpad m5.py, rss5b.py, rss5c.py |
| L159 | Rainfall per unit on the author’s computer (crop_insurance_book, Chapter 6 published run): one year (2019, 36 dekads) for the 99 insured units took 41.6 s with ST_Clip + ST_SummaryStats, 28.1 s with ST_Value per weight row (through a LATERAL subquery that drops nodata values; 14.4 s for a plain sum(ST_Value(...) * ha) in a trial run), 0.9 s with the weight table joined to ST_PixelAsPoints (the last two equal within 1.4e-12 mm a year); idx.paddy_weight built in 10 s, idx.dekad_rain (531,981 rows, 52 MB) in 46 s; the whole chapter 152 s. ST_WorldToRasterCoord and the floor arithmetic on the raster georeference place 958,167 of 958,169 inside points in the same cell; the 2 others (Garut, 0.36 ha) lie within 2e-8 of a cell width from a cell edge, and ST_WorldToRasterCoord over all fields took 40 s |
MEASURED 2026-12-01 | Chapter 6 on crop_insurance_book; scratchpad exp6.py, exp6b.py, exp6d.py |
| L160 | ST_Clip(rast, geom, touched => true) in PostGIS 3.7.0 keeps fewer cells than the polygon intersects for 16 of the 99 insured units (dekad 2019-01-11): 32 of 6,605 intersecting cells are left out, 12 of them holding paddy (555 ha by idx.paddy_weight), and it keeps no cell that does not intersect. Kota Pekalongan (3375): 4 cells kept of 6 intersecting; the 2 left out (column 94) overlap the unit by about 3.9 km2 and hold 159 ha of its paddy. crop => false gives the same cells. Intersecting cells from ST_PixelAsPolygons + ST_Intersects |
MEASURED 2026-12-01 | crop_insurance_book; scratchpad pek.py, pek2.py, touched_all.py |
| L161 | PostGIS raster cells are numbered from 1: “Column and row starts at 1” (ST_RasterToWorldCoord manual page). ST_WorldToRasterCoord uses rt_raster_geopoint_to_cell in raster/rt_core/rt_raster.c: when the fractional column or row equals its rounded value within the FLT_EQ tolerance it snaps to that whole number, otherwise it takes the floor, so a point within about 1e-8 of a cell edge lands in the next cell (the 2 fields of L159). The manual page of ST_WorldToRasterCoord does not describe this |
CITED 2026-12-01 (read by the Chapter 6 review agents) | https://postgis.net/docs/RT_ST_RasterToWorldCoord.html; https://github.com/postgis/postgis/blob/master/raster/rt_core/rt_raster.c |
| L162 | Chapter 6’s tables on crop_insurance_book against the scripts’ (crop_insurance): idx.paddy_weight has the same 7,002 keys, ha equal within 3.9e-12; idx.dekad_rain the same 531,981 keys, ha_used within 2.2e-11 and mm within 0.00010 mm, which stays inside the gap of the dekad rasters themselves (the scripts’ idx.chirps_dekad predates ORDER BY day, up to 0.00018 mm, L149) |
MEASURED 2026-12-01 | scratchpad cmp_book6.py |
| L163 | Onsets cut off by the start of the search window (99 insured units, 1991-2020, paddy-weighted rain of regime ‘all’): the wet-season onset falls on 1 September, the first dekad searched, in 121 of 2,970 unit-years, and in 99 of these the dekad of 21 August also had at least 50 mm, so the wet run had begun before the window; the dry-season onset falls on 1 March in 93 unit-years, 33 of them with 21 February also under 50 mm. Such years pull the unit medians early. ST_CoverageSimplify(geometry, 0.005) OVER () on ref.kabupaten returns geometries with SRID 0 (PostGIS 3.7.0, GEOS 3.15.1) |
MEASURED 2026-12-01 | crop_insurance_book; scratchpad censor7.py; Chapter 7 SQL review |
| L164 | Chapter 7’s tables on crop_insurance_book equal the scripts’ (crop_insurance) row for row (md5 over all columns): idx.crop_stage (3 rows), idx.crop_calendar (198), idx.season_dekad (90,130), although idx.dekad_rain differs by up to 0.0001 mm (L162). Garut (3205), 1991-2020: wet-season onset in all 30 crop years, 2 of them on 1 September; dry-season onset in 27 of 30 years (none in 1998, 2010, 2016). Chapter 7 ran in 19 s | MEASURED 2026-12-01 | scratchpad cmp_book7.py; Chapter 7 outputs |
| L165 | Chapter 8’s idx.season_index on crop_insurance_book against the scripts’ (crop_insurance): same 35,640 keys and column order; deficit_prank and stage_mean_prank identical, rain, normal and deficit within 4.3e-5 mm (dekad rain, L162). In 1991-2020, 10.7% of stage ranks are exactly 0 (stages without a deficit tie at 0); 1 of 792 reference groups (3273, MK1, reproductive) tops out below 29/30 because two rainless years tie at the normal. Window percent_rank() over the record to 2025 against the record to 2024 changes the rank of 4,159 (MH) and 4,118 (MK1) of 4,356 past season deficits, up to 0.023. Index percentiles over 1991-2020: MK1 80th 0.722, 95th 0.839; MH 0.644, 0.800 (L70’s figures predate the fixed-reference build). In PostgreSQL 18.7, SET NOT NULL on a column holding NULLs fails with column ... contains null values |
MEASURED 2026-12-01 | Chapter 8 outputs; scratchpad cmp_book8.py; Chapter 8 SQL and claims reviews |
| L166 | The equal-weight index (mean of three stage ranks k/30) was a float average: 3,339 of 8,910 season values lay one rounding step (2.2e-16) off the double nearest their exact value j/90, so 11 unit-seasons paid between 0 and 1e-9 where the index equalled the trigger and 10 paid 0.99999… instead of 1 (Chapter 9 SQL review). Since 2026-12-02 stage_mean_prank is round(avg(...)::numeric, 12)::double precision in scripts/build_season_index.py and Chapter 8. Rebuilt chain on crop_insurance: 1,111 payouts change by at most 1.9e-11, the near-zero ones become 0; payout frequency 1981-2025 MK1 0.1773 to 0.1758, MH 0.1953 to 0.1944; final record 1981-2024 MK1 0.172 to 0.171, MH 0.196 to 0.195; reference 1991-2020 MK1 0.192 to 0.190, MH 0.194 to 0.193; MH 2021-2024 0.177 to 0.174; MH 1997 full payouts 48 to 49; basis risk: MH Java payouts 96 to 95 (Jawa Tengah 31 to 30, payout years 3 to 2); pure premiums, thresholds, worst years and every MK1 basis-risk figure unchanged. L74, L80, L93, L94, L103 and L106 updated |
MEASURED 2026-12-02 | scratchpad exactfix/ (before and after dumps and check outputs); python scripts/check_season_index.py, check_contract.py, check_basis_risk.py, check_backtest.py |
| L167 | psycopg 3.3.9 and PostgreSQL 18.7 details used in Chapter 9: a Python int passed as a parameter is sent as the smallest type that holds it (5 and 1991 as smallint, 70000 as integer), so CREATE TABLE ... AS SELECT %s AS x makes a smallint column unless cast; a query sent with parameters (even an empty dict) is parsed for placeholders: %% becomes %, a single %s inside a string literal silently becomes $1, other % sequences raise ProgrammingError, while a query sent without parameters reaches PostgreSQL unchanged. idx.payout with all-constant arguments is folded to a constant when the query is planned, but is not inlined with column arguments (EXPLAIN VERBOSE); without STRICT its body returns 0 for a NULL index, because greatest and least skip NULL arguments |
MEASURED 2026-12-02 (Chapter 9 SQL and claims reviews) | scratchpad sqlrev9/ro1.py-ro5.py, audit_psycopg_probe.py, audit_fn_probe.py; https://www.psycopg.org/psycopg3/docs/basic/params.html; https://www.postgresql.org/docs/18/functions-conditional.html |
| L168 | Chapter 9 on crop_insurance_book (after L166): idx.contract and out.payout equal the scripts’ tables value for value (kabupaten_code is character(4) in the book database, text in the scripts’, from Chapter 5). Garut (3205): MH trigger 0.620, exit 0.773; MK1 trigger 0.711, exit 0.767; 16 paying seasons of 90. Crop years with 50 or more of 99 units paying: MK1 7, MH 6 of 45, against 4.1e-12 and 1.9e-10 expected if units paid independently at the average frequency (binomial). Rebuilding ranks, index, thresholds and payouts with the record ending 2024 instead of 2025 changes 0 of 8,712 past payouts with ranks against 1991-2020, and 1,057 (up to 0.444) with whole-record window ranks (L73 and L80 counted 921 with the unrounded index) | MEASURED 2026-12-02 | Chapter 9 outputs; scratchpad cmp_book9.py |
| L169 | out.backtest_bootstrap gave the same intervals for the same seed only under the same query plan: which row met which random() value followed the join order, and planner settings moved a bound by up to 0.025 (work_mem, enable_material, join_collapse_limit; Chapter 10 SQL review). Since 2026-12-02 the draws are listed in a MATERIALIZED CTE in a fixed order (COLLATE "C") before random(1, n) is called, in scripts/build_backtest.py and Chapter 10; the reviewer measured identical results under those settings. New 90% intervals, final record 1981-2024: MK1 frequency 0.107-0.237, premium 0.068-0.171; MH 0.146-0.250, 0.085-0.165; out-of-reference MK1 0.036-0.242 / 0.017-0.165, MH 0.124-0.284 / 0.057-0.165 (L94, L106 updated); numpy bounds within 0.006 for periods of 10 or more crop years. worst_crop_year now breaks ties by the earlier crop year |
MEASURED 2026-12-02 | python scripts/build_backtest.py; python scripts/check_backtest.py; scratchpad sqlrev10/ |
| L170 | Chapter 10’s idx.backtest_period, out.backtest_year, out.backtest_summary and out.backtest_bootstrap (seed 0.20261201, 2,000 replicates) on crop_insurance_book equal the scripts’ objects value for value. In the chapter’s run, MK1 2021-2024 is the only final period whose 90% frequency interval (0.000-0.076) excludes the reference frequency (0.190); every other out-of-reference interval contains it. One replicate drawn in plain SQL with the same seed is shown; numpy’s own bootstrap bounds differ from the SQL ones by at most 0.004 | MEASURED 2026-12-02 | Chapter 10 outputs; scratchpad cmp_book10.py |
| L171 | Chapter 11 on crop_insurance_book: out.basis_risk (2,083 rows) and out.basis_risk_summary (12 rows) equal the scripts’ views in every column. MK1 Java bootstrap over crop years (seed 0.20261201, 2,000 replicates, fixed draw order): P(pay given loss) 0.274 (0.024-0.421), P(no loss given pay) 0.361 (0.235-0.700), payout share to loss 0.794 (0.520-0.882), 49 replicates without a payout (L84’s review used 5,000 replicates: 0.024-0.427). AUC of the index against drought loss, final unit-seasons: MK1 pooled 0.826, within-year 0.569 (mean of 9 crop years, equal weight; pair-weighted 0.595; L81’s review gave 0.571); MH 0.708 / 0.605 (3 crop years). False alarms in windows with no rice drought or flood report: MK1 8 of 35, MH 25 of 89. MH drought payouts on a flood event: 26 of 95 (27%) against 324 flood events in 895 unit-seasons (36%); MH drought index against flood events AUC 0.459 pooled, 0.510 within-year. The MH window (its extra month) overlaps the same crop year’s MK1 window in 434 unit crop years (4,049 ha drought and 10,782 ha flood terkena counted in both); no MK1 loss event depends on it (226 either way). Summary view and script: shares now coalesce empty numerators to 0 and the ceiling is NULL without losses (no current row changes) | MEASURED 2026-12-02 | Chapter 11 outputs; scratchpad cmp_book11.py; Chapter 11 SQL review (sqlrev11/) |
| L172 | How the datanonkom damage reports arise: collected each month by field officers, compiled by the Ministry of Agriculture, and published on the datanonkom portal | STATED 2026-12-02 by the series author, from domain knowledge; primary documentation not yet cited (see L113) | user message, 2026-12-02 |
| L173 | Local tile serving, measured 2026-12-02 (Python 3.14.10, Windows 11, PostgreSQL 18.7, PostGIS 3.7.0). Python’s HTTPServer sets allow_reuse_address = True (TCPServer False); on Windows, with SO_REUSEADDR on both, a second server binds a port the first holds and every request goes to the first (observed: port 8765 held by another python -m http.server, the chapter’s requests got 404 from it); with reuse off the bind fails with WinError 10048 (10013 when the holder did not set reuse). On Linux and macOS, reuse off can block a restart on the same port while closed connections wait (TIME_WAIT, standard socket behaviour, not tested here). The tile function’s row filter (geometry && envelope) was planned as an index scan on the kabupaten GiST index when inlined and as a sequential scan of the 119 rows in other forms; a redundant WHERE geom IS NOT NULL doubled the cost of a zoom-6 tile (0.81 s to 0.42 s without it), since ST_AsMVT skips rows without geometry. Only Kepulauan Seribu in tile 6/51/32 comes back without geometry over the zoom-6 Java tiles (bounding box only); rows lying in the 64-unit buffer keep their geometry |
MEASURED 2026-12-02 | Chapter 12 run and reviews; scratchpad ch12_audit_reuse.py, ch12_audit_reuse2.py, ch12_audit_explain.py, ch12_audit_null.py, sql12/ |
| L174 | The code cells of the 12 English chapters call 56 PostGIS ST_ functions and AddRasterConstraints, run raster2pgsql (Chapter 4), and import 13 third-party Python libraries: BeautifulSoup (bs4), geopandas, matplotlib, numpy, pandas, psycopg, pyarrow, pyproj, PyYAML, rasterio, requests, shapely and SQLAlchemy. Chapter 12’s map page loads MapLibre GL JS 4.7.1 in the browser. Only code is counted, not names in the prose; by job, 31 work on geometries (ST_SRID and ST_Union also take rasters), 22 on rasters and 3 make vector tiles |
MEASURED 2026-12-02 | scripts/software_inventory.py (--md en prints every function with its chapters) |