Skill Tracer
Skills › Scientific Agent Skills › geomaster › scientific-domains.md

scientific-domains.md

116 lines · skills/geomaster/references/scientific-domains.md at 5f2bc03

Open on GitHub
1# Scientific domain workflows
2
3These are domain-specific workflows and illustrative recipes, not calibrated
4predictive models. Inputs must have known spatial/temporal support, units, masks and
5provenance. See [review.md](review.md) for execution boundaries.
6

Scientific domain workflows

These are domain-specific workflows and illustrative recipes, not calibrated predictive models. Inputs must have known spatial/temporal support, units, masks and provenance. See review.md for execution boundaries.

Raw lines 1 to 6
7## Marine and coastal
8
9For coastal vulnerability, align DEM/bathymetry, shoreline, wave statistics and
10sea-level scenarios to compatible horizontal/vertical datums. State whether height
11is orthometric, ellipsoidal or tide-referenced. Define exposure and vulnerability
12separately; arbitrary weighted overlays do not estimate inundation probability.
13Sensitivity-test any expert weights and validate against independent coastal events.
15Benthic habitat mapping combines bathymetry, backscatter, slope/rugosity and labeled
16surveys. Derive slope using physical cell dimensions. Backscatter depends on sensor,
17incidence angle and calibration; thresholds such as -15 dB are not portable habitat
18labels. Use spatially withheld surveys and class uncertainty, and keep unsurveyed or
19out-of-domain cells explicitly unknown. CHM-style DSM-minus-DEM processing is not
20substitute bathymetric datum reconciliation.

Marine and coastal

For coastal vulnerability, align DEM/bathymetry, shoreline, wave statistics and sea-level scenarios to compatible horizontal/vertical datums. State whether height is orthometric, ellipsoidal or tide-referenced. Define exposure and vulnerability separately; arbitrary weighted overlays do not estimate inundation probability. Sensitivity-test any expert weights and validate against independent coastal events.

Benthic habitat mapping combines bathymetry, backscatter, slope/rugosity and labeled surveys. Derive slope using physical cell dimensions. Backscatter depends on sensor, incidence angle and calibration; thresholds such as -15 dB are not portable habitat labels. Use spatially withheld surveys and class uncertainty, and keep unsurveyed or out-of-domain cells explicitly unknown. CHM-style DSM-minus-DEM processing is not substitute bathymetric datum reconciliation.

Raw lines 7 to 21
22## Atmospheric and climate data
24ERA5 2 m temperature is Kelvin; convert to Celsius for that variable. Total
25precipitation accumulation has dataset-specific time support and units. Summing
26hourly temperature or already accumulated precipitation produces invalid metrics.
27Inspect coordinates before slicing: ERA5 latitude often decreases, and current files
28may use `valid_time` rather than `time`.
30```python
31import xarray as xr
33def subset_temperature(ds, west, south, east, north):
34 latitude = ds.latitude
35 bounds = slice(north, south) if latitude[0] > latitude[-1] else slice(south, north)
36 roi = ds.sel(latitude=bounds, longitude=slice(west, east))
37 time = 'valid_time' if 'valid_time' in roi.coords else 'time'
38 # This recipe assumes longitude convention already matches the bbox.
39 return (roi.t2m - 273.15).resample({time: 'MS'}).mean()
40```
42Do not label a z-score of rainfall as SPI. SPI requires a documented accumulation
43window, reference climatology, fitted distribution including zero precipitation,
44seasonal handling and out-of-sample validation. For rasters, select a single time,
45set spatial dimensions/CRS from metadata and preserve nodata before `rio.to_raster`.
47For PM2.5 kriging, transform sensors to a justified metric CRS first; `1000` means
48metres only in that coordinate system. Check station calibration/time alignment,
49variogram fit, duplicate coordinates, spatial holdouts and uncertainty. Use
50`OrdinaryKriging(..., coordinates_type='euclidean')` on projected coordinates;
51geographic mode has different longitude/latitude assumptions. Kriging variance is
52conditional on the fitted covariance model, not all measurement/model uncertainty.

Atmospheric and climate data

ERA5 2 m temperature is Kelvin; convert to Celsius for that variable. Total precipitation accumulation has dataset-specific time support and units. Summing hourly temperature or already accumulated precipitation produces invalid metrics. Inspect coordinates before slicing: ERA5 latitude often decreases, and current files may use valid_time rather than time.

import xarray as xr

def subset_temperature(ds, west, south, east, north):
    latitude = ds.latitude
    bounds = slice(north, south) if latitude[0] > latitude[-1] else slice(south, north)
    roi = ds.sel(latitude=bounds, longitude=slice(west, east))
    time = 'valid_time' if 'valid_time' in roi.coords else 'time'
    # This recipe assumes longitude convention already matches the bbox.
    return (roi.t2m - 273.15).resample({time: 'MS'}).mean()

Do not label a z-score of rainfall as SPI. SPI requires a documented accumulation window, reference climatology, fitted distribution including zero precipitation, seasonal handling and out-of-sample validation. For rasters, select a single time, set spatial dimensions/CRS from metadata and preserve nodata before rio.to_raster.

For PM2.5 kriging, transform sensors to a justified metric CRS first; 1000 means metres only in that coordinate system. Check station calibration/time alignment, variogram fit, duplicate coordinates, spatial holdouts and uncertainty. Use OrdinaryKriging(..., coordinates_type='euclidean') on projected coordinates; geographic mode has different longitude/latitude assumptions. Kriging variance is conditional on the fitted covariance model, not all measurement/model uncertainty.

Raw lines 22 to 53
54## Hydrology
561. Select a hydrologically appropriate DEM with known vertical/horizontal units;
57 assess voids, artifacts, bridges/culverts and true depressions.
582. Choose justified filling/breaching, then a named D8 or MFD implementation.
59 D8 compares elevation drop divided by neighbour distance, including diagonals.
603. Compute accumulation and retain its units (cells versus contributing area).
614. Snap the outlet to a justified stream cell, preserving original and snapped
62 locations. `rasterio.transform.rowcol(transform, x, y)` returns row,column;
63 applying the inverse affine directly yields column,row.
645. Delineate and verify basin closure/connectivity, known hydrography and edge effects.
66Use established hydrology implementations rather than an incomplete homemade D8 loop.
67For an initialized GRASS location/mapset with matching projected DEM (illustrative):
69```python
70import grass.script as gs
71gs.run_command('g.region', raster='dem', align='dem')
72gs.run_command('r.watershed', elevation='dem', accumulation='accumulation',
73 drainage='drainage', threshold=1000, flags='s')
74# flags='s' selects single-flow-direction; threshold is a model choice, not universal.
75```
77Inspect GRASS drainage conventions before supplying directions to another tool.
78The [r.watershed manual](https://grass.osgeo.org/grass-stable/manuals/r.watershed.html)
79describes its depression/edge treatment and output meaning.
81A flat-water “bathtub” map is only a screening scenario. It requires a water level
82in the DEM's vertical datum and a source-connectivity model; it does not estimate a
83return period, velocity, drainage response or hydraulic hazard. Validate against
84calibrated hydrodynamic modeling and observations before any operational use.

Hydrology

  1. Select a hydrologically appropriate DEM with known vertical/horizontal units; assess voids, artifacts, bridges/culverts and true depressions.
  2. Choose justified filling/breaching, then a named D8 or MFD implementation. D8 compares elevation drop divided by neighbour distance, including diagonals.
  3. Compute accumulation and retain its units (cells versus contributing area).
  4. Snap the outlet to a justified stream cell, preserving original and snapped locations. rasterio.transform.rowcol(transform, x, y) returns row,column; applying the inverse affine directly yields column,row.
  5. Delineate and verify basin closure/connectivity, known hydrography and edge effects.

Use established hydrology implementations rather than an incomplete homemade D8 loop. For an initialized GRASS location/mapset with matching projected DEM (illustrative):

import grass.script as gs
gs.run_command('g.region', raster='dem', align='dem')
gs.run_command('r.watershed', elevation='dem', accumulation='accumulation',
               drainage='drainage', threshold=1000, flags='s')
# flags='s' selects single-flow-direction; threshold is a model choice, not universal.

Inspect GRASS drainage conventions before supplying directions to another tool. The r.watershed manual describes its depression/edge treatment and output meaning.

A flat-water “bathtub” map is only a screening scenario. It requires a water level in the DEM's vertical datum and a source-connectivity model; it does not estimate a return period, velocity, drainage response or hydraulic hazard. Validate against calibrated hydrodynamic modeling and observations before any operational use.

Raw lines 54 to 85
86## Agriculture
88For crop condition, compare QA-masked NDVI/EVI time series to a locally matched crop,
89phenological stage and historical baseline. Record valid observation counts,
90compositing interval and missingness. NDVI maximum alone cannot infer tonnes/ha.
91Fit yield against measured harvest data with field/year holdouts and uncertainty.
93For precision agriculture, align soil chemistry, yield, crop demand and application
94history; standardize features before exploratory clustering. KMeans labels are
95management-zone candidates, not fertilizer prescriptions. Nutrient recommendations
96need locally calibrated agronomic response models, unit reconciliation and applicable
97constraints. A yield value in tonnes/ha multiplied by a kg/kg coefficient needs the
98explicit tonne-to-kg conversion and does not account for existing soil supply.

Agriculture

For crop condition, compare QA-masked NDVI/EVI time series to a locally matched crop, phenological stage and historical baseline. Record valid observation counts, compositing interval and missingness. NDVI maximum alone cannot infer tonnes/ha. Fit yield against measured harvest data with field/year holdouts and uncertainty.

For precision agriculture, align soil chemistry, yield, crop demand and application history; standardize features before exploratory clustering. KMeans labels are management-zone candidates, not fertilizer prescriptions. Nutrient recommendations need locally calibrated agronomic response models, unit reconciliation and applicable constraints. A yield value in tonnes/ha multiplied by a kg/kg coefficient needs the explicit tonne-to-kg conversion and does not account for existing soil supply.

Raw lines 86 to 99
100## Forestry
102Validate DSM/DEM grids and vertical datums before deriving canopy height. At each
103survey plot, report valid-cell fraction and physically justified height/cover metrics.
104Biomass requires a calibrated allometric/model relation with species, plot design,
105units and transfer limits; arbitrary powers of height/cover are not tonnes.
107Change detection compares co-registered, seasonally comparable, calibrated imagery
108with joint valid support. An NDVI decrease is a vegetation-change candidate, not
109proof of deforestation: drought, harvest, cloud/shadow and fire can look similar.
110Confirm with independent labels/multitemporal evidence. Derive area from the affine
111determinant in a suitable metric/equal-area CRS, not a fixed 900 m² assumption.
113Sources: [ERA5 single levels](https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels),
114[PyKrige](https://geostat-framework.readthedocs.io/projects/pykrige/en/stable/generated/pykrige.ok.OrdinaryKriging.html),
115[Rasterio transforms](https://rasterio.readthedocs.io/en/stable/topics/transforms.html),
116[GRASS hydrology](https://grass.osgeo.org/grass-stable/manuals/r.watershed.html).

Forestry

Validate DSM/DEM grids and vertical datums before deriving canopy height. At each survey plot, report valid-cell fraction and physically justified height/cover metrics. Biomass requires a calibrated allometric/model relation with species, plot design, units and transfer limits; arbitrary powers of height/cover are not tonnes.

Change detection compares co-registered, seasonally comparable, calibrated imagery with joint valid support. An NDVI decrease is a vegetation-change candidate, not proof of deforestation: drought, harvest, cloud/shadow and fire can look similar. Confirm with independent labels/multitemporal evidence. Derive area from the affine determinant in a suitable metric/equal-area CRS, not a fixed 900 m² assumption.

Sources: ERA5 single levels, PyKrige, Rasterio transforms, GRASS hydrology.

Raw lines 100 to 116