@bgicli/bgicli 2.2.8 → 2.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/skills/anthropic-algorithmic-art/SKILL.md +405 -0
- package/data/skills/anthropic-canvas-design/SKILL.md +130 -0
- package/data/skills/anthropic-claude-api/SKILL.md +243 -0
- package/data/skills/anthropic-doc-coauthoring/SKILL.md +375 -0
- package/data/skills/anthropic-docx/SKILL.md +590 -0
- package/data/skills/anthropic-frontend-design/SKILL.md +42 -0
- package/data/skills/anthropic-internal-comms/SKILL.md +32 -0
- package/data/skills/anthropic-mcp-builder/SKILL.md +236 -0
- package/data/skills/anthropic-pdf/SKILL.md +314 -0
- package/data/skills/anthropic-pptx/SKILL.md +232 -0
- package/data/skills/anthropic-skill-creator/SKILL.md +485 -0
- package/data/skills/anthropic-webapp-testing/SKILL.md +96 -0
- package/data/skills/anthropic-xlsx/SKILL.md +292 -0
- package/data/skills/arxiv-database/SKILL.md +362 -0
- package/data/skills/astropy/SKILL.md +329 -0
- package/data/skills/ctx-advanced-evaluation/SKILL.md +402 -0
- package/data/skills/ctx-bdi-mental-states/SKILL.md +311 -0
- package/data/skills/ctx-context-compression/SKILL.md +272 -0
- package/data/skills/ctx-context-degradation/SKILL.md +206 -0
- package/data/skills/ctx-context-fundamentals/SKILL.md +201 -0
- package/data/skills/ctx-context-optimization/SKILL.md +195 -0
- package/data/skills/ctx-evaluation/SKILL.md +251 -0
- package/data/skills/ctx-filesystem-context/SKILL.md +287 -0
- package/data/skills/ctx-hosted-agents/SKILL.md +260 -0
- package/data/skills/ctx-memory-systems/SKILL.md +225 -0
- package/data/skills/ctx-multi-agent-patterns/SKILL.md +257 -0
- package/data/skills/ctx-project-development/SKILL.md +291 -0
- package/data/skills/ctx-tool-design/SKILL.md +271 -0
- package/data/skills/dhdna-profiler/SKILL.md +162 -0
- package/data/skills/generate-image/SKILL.md +183 -0
- package/data/skills/geomaster/SKILL.md +365 -0
- package/data/skills/get-available-resources/SKILL.md +275 -0
- package/data/skills/hamelsmu-build-review-interface/SKILL.md +96 -0
- package/data/skills/hamelsmu-error-analysis/SKILL.md +164 -0
- package/data/skills/hamelsmu-eval-audit/SKILL.md +183 -0
- package/data/skills/hamelsmu-evaluate-rag/SKILL.md +177 -0
- package/data/skills/hamelsmu-generate-synthetic-data/SKILL.md +131 -0
- package/data/skills/hamelsmu-validate-evaluator/SKILL.md +212 -0
- package/data/skills/hamelsmu-write-judge-prompt/SKILL.md +144 -0
- package/data/skills/hf-cli/SKILL.md +174 -0
- package/data/skills/hf-mcp/SKILL.md +178 -0
- package/data/skills/hugging-face-dataset-viewer/SKILL.md +121 -0
- package/data/skills/hugging-face-datasets/SKILL.md +542 -0
- package/data/skills/hugging-face-evaluation/SKILL.md +651 -0
- package/data/skills/hugging-face-jobs/SKILL.md +1042 -0
- package/data/skills/hugging-face-model-trainer/SKILL.md +717 -0
- package/data/skills/hugging-face-paper-pages/SKILL.md +239 -0
- package/data/skills/hugging-face-paper-publisher/SKILL.md +624 -0
- package/data/skills/hugging-face-tool-builder/SKILL.md +110 -0
- package/data/skills/hugging-face-trackio/SKILL.md +115 -0
- package/data/skills/hugging-face-vision-trainer/SKILL.md +593 -0
- package/data/skills/huggingface-gradio/SKILL.md +245 -0
- package/data/skills/matlab/SKILL.md +376 -0
- package/data/skills/modal/SKILL.md +381 -0
- package/data/skills/openai-cloudflare-deploy/SKILL.md +224 -0
- package/data/skills/openai-develop-web-game/SKILL.md +149 -0
- package/data/skills/openai-doc/SKILL.md +80 -0
- package/data/skills/openai-figma/SKILL.md +42 -0
- package/data/skills/openai-figma-implement-design/SKILL.md +264 -0
- package/data/skills/openai-gh-address-comments/SKILL.md +25 -0
- package/data/skills/openai-gh-fix-ci/SKILL.md +69 -0
- package/data/skills/openai-imagegen/SKILL.md +174 -0
- package/data/skills/openai-jupyter-notebook/SKILL.md +107 -0
- package/data/skills/openai-linear/SKILL.md +87 -0
- package/data/skills/openai-netlify-deploy/SKILL.md +247 -0
- package/data/skills/openai-notion-knowledge-capture/SKILL.md +56 -0
- package/data/skills/openai-notion-meeting-intelligence/SKILL.md +60 -0
- package/data/skills/openai-notion-research-documentation/SKILL.md +59 -0
- package/data/skills/openai-notion-spec-to-implementation/SKILL.md +58 -0
- package/data/skills/openai-openai-docs/SKILL.md +69 -0
- package/data/skills/openai-pdf/SKILL.md +67 -0
- package/data/skills/openai-playwright/SKILL.md +147 -0
- package/data/skills/openai-render-deploy/SKILL.md +479 -0
- package/data/skills/openai-screenshot/SKILL.md +267 -0
- package/data/skills/openai-security-best-practices/SKILL.md +86 -0
- package/data/skills/openai-security-ownership-map/SKILL.md +206 -0
- package/data/skills/openai-security-threat-model/SKILL.md +81 -0
- package/data/skills/openai-sentry/SKILL.md +123 -0
- package/data/skills/openai-sora/SKILL.md +178 -0
- package/data/skills/openai-speech/SKILL.md +144 -0
- package/data/skills/openai-spreadsheet/SKILL.md +145 -0
- package/data/skills/openai-transcribe/SKILL.md +81 -0
- package/data/skills/openai-vercel-deploy/SKILL.md +77 -0
- package/data/skills/openai-yeet/SKILL.md +28 -0
- package/data/skills/pennylane/SKILL.md +224 -0
- package/data/skills/polars-bio/SKILL.md +374 -0
- package/data/skills/primekg/SKILL.md +97 -0
- package/data/skills/pymatgen/SKILL.md +689 -0
- package/data/skills/qiskit/SKILL.md +273 -0
- package/data/skills/qutip/SKILL.md +316 -0
- package/data/skills/recursive-decomposition/SKILL.md +185 -0
- package/data/skills/rowan/SKILL.md +427 -0
- package/data/skills/scholar-evaluation/SKILL.md +298 -0
- package/data/skills/sentry-create-alert/SKILL.md +210 -0
- package/data/skills/sentry-fix-issues/SKILL.md +126 -0
- package/data/skills/sentry-pr-code-review/SKILL.md +105 -0
- package/data/skills/sentry-python-sdk/SKILL.md +317 -0
- package/data/skills/sentry-setup-ai-monitoring/SKILL.md +217 -0
- package/data/skills/stable-baselines3/SKILL.md +297 -0
- package/data/skills/sympy/SKILL.md +498 -0
- package/data/skills/trailofbits-ask-questions-if-underspecified/SKILL.md +85 -0
- package/data/skills/trailofbits-audit-context-building/SKILL.md +302 -0
- package/data/skills/trailofbits-differential-review/SKILL.md +220 -0
- package/data/skills/trailofbits-insecure-defaults/SKILL.md +117 -0
- package/data/skills/trailofbits-modern-python/SKILL.md +333 -0
- package/data/skills/trailofbits-property-based-testing/SKILL.md +123 -0
- package/data/skills/trailofbits-semgrep-rule-creator/SKILL.md +172 -0
- package/data/skills/trailofbits-sharp-edges/SKILL.md +292 -0
- package/data/skills/trailofbits-variant-analysis/SKILL.md +142 -0
- package/data/skills/transformers.js/SKILL.md +637 -0
- package/data/skills/writing/SKILL.md +419 -0
- package/dist/bgi.js +66 -2
- package/package.json +1 -1
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: geomaster
|
|
3
|
+
description: Comprehensive geospatial science skill covering remote sensing, GIS, spatial analysis, machine learning for earth observation, and 30+ scientific domains. Supports satellite imagery processing (Sentinel, Landsat, MODIS, SAR, hyperspectral), vector and raster data operations, spatial statistics, point cloud processing, network analysis, cloud-native workflows (STAC, COG, Planetary Computer), and 8 programming languages (Python, R, Julia, JavaScript, C++, Java, Go, Rust) with 500+ code examples. Use for remote sensing workflows, GIS analysis, spatial ML, Earth observation data processing, terrain analysis, hydrological modeling, marine spatial analysis, atmospheric science, and any geospatial computation task.
|
|
4
|
+
license: MIT License
|
|
5
|
+
metadata:
|
|
6
|
+
skill-author: K-Dense Inc.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# GeoMaster
|
|
10
|
+
|
|
11
|
+
Comprehensive geospatial science skill covering GIS, remote sensing, spatial analysis, and ML for Earth observation across 70+ topics with 500+ code examples in 8 programming languages.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Core Python stack (conda recommended)
|
|
17
|
+
conda install -c conda-forge gdal rasterio fiona shapely pyproj geopandas
|
|
18
|
+
|
|
19
|
+
# Remote sensing & ML
|
|
20
|
+
uv pip install rsgislib torchgeo earthengine-api
|
|
21
|
+
uv pip install scikit-learn xgboost torch-geometric
|
|
22
|
+
|
|
23
|
+
# Network & visualization
|
|
24
|
+
uv pip install osmnx networkx folium keplergl
|
|
25
|
+
uv pip install cartopy contextily mapclassify
|
|
26
|
+
|
|
27
|
+
# Big data & cloud
|
|
28
|
+
uv pip install xarray rioxarray dask-geopandas
|
|
29
|
+
uv pip install pystac-client planetary-computer
|
|
30
|
+
|
|
31
|
+
# Point clouds
|
|
32
|
+
uv pip install laspy pylas open3d pdal
|
|
33
|
+
|
|
34
|
+
# Databases
|
|
35
|
+
conda install -c conda-forge postgis spatialite
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
### NDVI from Sentinel-2
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
import rasterio
|
|
44
|
+
import numpy as np
|
|
45
|
+
|
|
46
|
+
with rasterio.open('sentinel2.tif') as src:
|
|
47
|
+
red = src.read(4).astype(float) # B04
|
|
48
|
+
nir = src.read(8).astype(float) # B08
|
|
49
|
+
ndvi = (nir - red) / (nir + red + 1e-8)
|
|
50
|
+
ndvi = np.nan_to_num(ndvi, nan=0)
|
|
51
|
+
|
|
52
|
+
profile = src.profile
|
|
53
|
+
profile.update(count=1, dtype=rasterio.float32)
|
|
54
|
+
|
|
55
|
+
with rasterio.open('ndvi.tif', 'w', **profile) as dst:
|
|
56
|
+
dst.write(ndvi.astype(rasterio.float32), 1)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Spatial Analysis with GeoPandas
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import geopandas as gpd
|
|
63
|
+
|
|
64
|
+
# Load and ensure same CRS
|
|
65
|
+
zones = gpd.read_file('zones.geojson')
|
|
66
|
+
points = gpd.read_file('points.geojson')
|
|
67
|
+
|
|
68
|
+
if zones.crs != points.crs:
|
|
69
|
+
points = points.to_crs(zones.crs)
|
|
70
|
+
|
|
71
|
+
# Spatial join and statistics
|
|
72
|
+
joined = gpd.sjoin(points, zones, how='inner', predicate='within')
|
|
73
|
+
stats = joined.groupby('zone_id').agg({
|
|
74
|
+
'value': ['count', 'mean', 'std', 'min', 'max']
|
|
75
|
+
}).round(2)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Google Earth Engine Time Series
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
import ee
|
|
82
|
+
import pandas as pd
|
|
83
|
+
|
|
84
|
+
ee.Initialize(project='your-project')
|
|
85
|
+
roi = ee.Geometry.Point([-122.4, 37.7]).buffer(10000)
|
|
86
|
+
|
|
87
|
+
s2 = (ee.ImageCollection('COPERNICUS/S2_SR_HARMONIZED')
|
|
88
|
+
.filterBounds(roi)
|
|
89
|
+
.filterDate('2020-01-01', '2023-12-31')
|
|
90
|
+
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20)))
|
|
91
|
+
|
|
92
|
+
def add_ndvi(img):
|
|
93
|
+
return img.addBands(img.normalizedDifference(['B8', 'B4']).rename('NDVI'))
|
|
94
|
+
|
|
95
|
+
s2_ndvi = s2.map(add_ndvi)
|
|
96
|
+
|
|
97
|
+
def extract_series(image):
|
|
98
|
+
stats = image.reduceRegion(ee.Reducer.mean(), roi.centroid(), scale=10, maxPixels=1e9)
|
|
99
|
+
return ee.Feature(None, {'date': image.date().format('YYYY-MM-dd'), 'ndvi': stats.get('NDVI')})
|
|
100
|
+
|
|
101
|
+
series = s2_ndvi.map(extract_series).getInfo()
|
|
102
|
+
df = pd.DataFrame([f['properties'] for f in series['features']])
|
|
103
|
+
df['date'] = pd.to_datetime(df['date'])
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Core Concepts
|
|
107
|
+
|
|
108
|
+
### Data Types
|
|
109
|
+
|
|
110
|
+
| Type | Examples | Libraries |
|
|
111
|
+
|------|----------|-----------|
|
|
112
|
+
| Vector | Shapefile, GeoJSON, GeoPackage | GeoPandas, Fiona, GDAL |
|
|
113
|
+
| Raster | GeoTIFF, NetCDF, COG | Rasterio, Xarray, GDAL |
|
|
114
|
+
| Point Cloud | LAS, LAZ | Laspy, PDAL, Open3D |
|
|
115
|
+
|
|
116
|
+
### Coordinate Systems
|
|
117
|
+
|
|
118
|
+
- **EPSG:4326** (WGS 84) - Geographic, lat/lon, use for storage
|
|
119
|
+
- **EPSG:3857** (Web Mercator) - Web maps only (don't use for area/distance!)
|
|
120
|
+
- **EPSG:326xx/327xx** (UTM) - Metric calculations, <1% distortion per zone
|
|
121
|
+
- Use `gdf.estimate_utm_crs()` for automatic UTM detection
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
# Always check CRS before operations
|
|
125
|
+
assert gdf1.crs == gdf2.crs, "CRS mismatch!"
|
|
126
|
+
|
|
127
|
+
# For area/distance calculations, use projected CRS
|
|
128
|
+
gdf_metric = gdf.to_crs(gdf.estimate_utm_crs())
|
|
129
|
+
area_sqm = gdf_metric.geometry.area
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### OGC Standards
|
|
133
|
+
|
|
134
|
+
- **WMS**: Web Map Service - raster maps
|
|
135
|
+
- **WFS**: Web Feature Service - vector data
|
|
136
|
+
- **WCS**: Web Coverage Service - raster coverage
|
|
137
|
+
- **STAC**: Spatiotemporal Asset Catalog - modern metadata
|
|
138
|
+
|
|
139
|
+
## Common Operations
|
|
140
|
+
|
|
141
|
+
### Spectral Indices
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
def calculate_indices(image_path):
|
|
145
|
+
"""NDVI, EVI, SAVI, NDWI from Sentinel-2."""
|
|
146
|
+
with rasterio.open(image_path) as src:
|
|
147
|
+
B02, B03, B04, B08, B11 = [src.read(i).astype(float) for i in [1,2,3,4,5]]
|
|
148
|
+
|
|
149
|
+
ndvi = (B08 - B04) / (B08 + B04 + 1e-8)
|
|
150
|
+
evi = 2.5 * (B08 - B04) / (B08 + 6*B04 - 7.5*B02 + 1)
|
|
151
|
+
savi = ((B08 - B04) / (B08 + B04 + 0.5)) * 1.5
|
|
152
|
+
ndwi = (B03 - B08) / (B03 + B08 + 1e-8)
|
|
153
|
+
|
|
154
|
+
return {'NDVI': ndvi, 'EVI': evi, 'SAVI': savi, 'NDWI': ndwi}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Vector Operations
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
# Buffer (use projected CRS!)
|
|
161
|
+
gdf_proj = gdf.to_crs(gdf.estimate_utm_crs())
|
|
162
|
+
gdf['buffer_1km'] = gdf_proj.geometry.buffer(1000)
|
|
163
|
+
|
|
164
|
+
# Spatial relationships
|
|
165
|
+
intersects = gdf[gdf.geometry.intersects(other_geometry)]
|
|
166
|
+
contains = gdf[gdf.geometry.contains(point_geometry)]
|
|
167
|
+
|
|
168
|
+
# Geometric operations
|
|
169
|
+
gdf['centroid'] = gdf.geometry.centroid
|
|
170
|
+
gdf['simplified'] = gdf.geometry.simplify(tolerance=0.001)
|
|
171
|
+
|
|
172
|
+
# Overlay operations
|
|
173
|
+
intersection = gpd.overlay(gdf1, gdf2, how='intersection')
|
|
174
|
+
union = gpd.overlay(gdf1, gdf2, how='union')
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Terrain Analysis
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
def terrain_metrics(dem_path):
|
|
181
|
+
"""Calculate slope, aspect, hillshade from DEM."""
|
|
182
|
+
with rasterio.open(dem_path) as src:
|
|
183
|
+
dem = src.read(1)
|
|
184
|
+
|
|
185
|
+
dy, dx = np.gradient(dem)
|
|
186
|
+
slope = np.arctan(np.sqrt(dx**2 + dy**2)) * 180 / np.pi
|
|
187
|
+
aspect = (90 - np.arctan2(-dy, dx) * 180 / np.pi) % 360
|
|
188
|
+
|
|
189
|
+
# Hillshade
|
|
190
|
+
az_rad, alt_rad = np.radians(315), np.radians(45)
|
|
191
|
+
hillshade = (np.sin(alt_rad) * np.sin(np.radians(slope)) +
|
|
192
|
+
np.cos(alt_rad) * np.cos(np.radians(slope)) *
|
|
193
|
+
np.cos(np.radians(aspect) - az_rad))
|
|
194
|
+
|
|
195
|
+
return slope, aspect, hillshade
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Network Analysis
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
import osmnx as ox
|
|
202
|
+
import networkx as nx
|
|
203
|
+
|
|
204
|
+
# Download and analyze street network
|
|
205
|
+
G = ox.graph_from_place('San Francisco, CA', network_type='drive')
|
|
206
|
+
G = ox.add_edge_speeds(G).add_edge_travel_times(G)
|
|
207
|
+
|
|
208
|
+
# Shortest path
|
|
209
|
+
orig = ox.distance.nearest_nodes(G, -122.4, 37.7)
|
|
210
|
+
dest = ox.distance.nearest_nodes(G, -122.3, 37.8)
|
|
211
|
+
route = nx.shortest_path(G, orig, dest, weight='travel_time')
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Image Classification
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
from sklearn.ensemble import RandomForestClassifier
|
|
218
|
+
import rasterio
|
|
219
|
+
from rasterio.features import rasterize
|
|
220
|
+
|
|
221
|
+
def classify_imagery(raster_path, training_gdf, output_path):
|
|
222
|
+
"""Train RF and classify imagery."""
|
|
223
|
+
with rasterio.open(raster_path) as src:
|
|
224
|
+
image = src.read()
|
|
225
|
+
profile = src.profile
|
|
226
|
+
transform = src.transform
|
|
227
|
+
|
|
228
|
+
# Extract training data
|
|
229
|
+
X_train, y_train = [], []
|
|
230
|
+
for _, row in training_gdf.iterrows():
|
|
231
|
+
mask = rasterize([(row.geometry, 1)],
|
|
232
|
+
out_shape=(profile['height'], profile['width']),
|
|
233
|
+
transform=transform, fill=0, dtype=np.uint8)
|
|
234
|
+
pixels = image[:, mask > 0].T
|
|
235
|
+
X_train.extend(pixels)
|
|
236
|
+
y_train.extend([row['class_id']] * len(pixels))
|
|
237
|
+
|
|
238
|
+
# Train and predict
|
|
239
|
+
rf = RandomForestClassifier(n_estimators=100, max_depth=20, n_jobs=-1)
|
|
240
|
+
rf.fit(X_train, y_train)
|
|
241
|
+
|
|
242
|
+
prediction = rf.predict(image.reshape(image.shape[0], -1).T)
|
|
243
|
+
prediction = prediction.reshape(profile['height'], profile['width'])
|
|
244
|
+
|
|
245
|
+
profile.update(dtype=rasterio.uint8, count=1)
|
|
246
|
+
with rasterio.open(output_path, 'w', **profile) as dst:
|
|
247
|
+
dst.write(prediction.astype(rasterio.uint8), 1)
|
|
248
|
+
|
|
249
|
+
return rf
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Modern Cloud-Native Workflows
|
|
253
|
+
|
|
254
|
+
### STAC + Planetary Computer
|
|
255
|
+
|
|
256
|
+
```python
|
|
257
|
+
import pystac_client
|
|
258
|
+
import planetary_computer
|
|
259
|
+
import odc.stac
|
|
260
|
+
|
|
261
|
+
# Search Sentinel-2 via STAC
|
|
262
|
+
catalog = pystac_client.Client.open(
|
|
263
|
+
"https://planetarycomputer.microsoft.com/api/stac/v1",
|
|
264
|
+
modifier=planetary_computer.sign_inplace,
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
search = catalog.search(
|
|
268
|
+
collections=["sentinel-2-l2a"],
|
|
269
|
+
bbox=[-122.5, 37.7, -122.3, 37.9],
|
|
270
|
+
datetime="2023-01-01/2023-12-31",
|
|
271
|
+
query={"eo:cloud_cover": {"lt": 20}},
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
# Load as xarray (cloud-native!)
|
|
275
|
+
data = odc.stac.load(
|
|
276
|
+
list(search.get_items())[:5],
|
|
277
|
+
bands=["B02", "B03", "B04", "B08"],
|
|
278
|
+
crs="EPSG:32610",
|
|
279
|
+
resolution=10,
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
# Calculate NDVI on xarray
|
|
283
|
+
ndvi = (data.B08 - data.B04) / (data.B08 + data.B04)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Cloud-Optimized GeoTIFF (COG)
|
|
287
|
+
|
|
288
|
+
```python
|
|
289
|
+
import rasterio
|
|
290
|
+
from rasterio.session import AWSSession
|
|
291
|
+
|
|
292
|
+
# Read COG directly from cloud (partial reads)
|
|
293
|
+
session = AWSSession(aws_access_key_id=..., aws_secret_access_key=...)
|
|
294
|
+
with rasterio.open('s3://bucket/path.tif', session=session) as src:
|
|
295
|
+
# Read only window of interest
|
|
296
|
+
window = ((1000, 2000), (1000, 2000))
|
|
297
|
+
subset = src.read(1, window=window)
|
|
298
|
+
|
|
299
|
+
# Write COG
|
|
300
|
+
with rasterio.open('output.tif', 'w', **profile,
|
|
301
|
+
tiled=True, blockxsize=256, blockysize=256,
|
|
302
|
+
compress='DEFLATE', predictor=2) as dst:
|
|
303
|
+
dst.write(data)
|
|
304
|
+
|
|
305
|
+
# Validate COG
|
|
306
|
+
from rio_cogeo.cogeo import cog_validate
|
|
307
|
+
cog_validate('output.tif')
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## Performance Tips
|
|
311
|
+
|
|
312
|
+
```python
|
|
313
|
+
# 1. Spatial indexing (10-100x faster queries)
|
|
314
|
+
gdf.sindex # Auto-created by GeoPandas
|
|
315
|
+
|
|
316
|
+
# 2. Chunk large rasters
|
|
317
|
+
with rasterio.open('large.tif') as src:
|
|
318
|
+
for i, window in src.block_windows(1):
|
|
319
|
+
block = src.read(1, window=window)
|
|
320
|
+
|
|
321
|
+
# 3. Dask for big data
|
|
322
|
+
import dask.array as da
|
|
323
|
+
dask_array = da.from_rasterio('large.tif', chunks=(1, 1024, 1024))
|
|
324
|
+
|
|
325
|
+
# 4. Use Arrow for I/O
|
|
326
|
+
gdf.to_file('output.gpkg', use_arrow=True)
|
|
327
|
+
|
|
328
|
+
# 5. GDAL caching
|
|
329
|
+
from osgeo import gdal
|
|
330
|
+
gdal.SetCacheMax(2**30) # 1GB cache
|
|
331
|
+
|
|
332
|
+
# 6. Parallel processing
|
|
333
|
+
rf = RandomForestClassifier(n_jobs=-1) # All cores
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## Best Practices
|
|
337
|
+
|
|
338
|
+
1. **Always check CRS** before spatial operations
|
|
339
|
+
2. **Use projected CRS** for area/distance calculations
|
|
340
|
+
3. **Validate geometries**: `gdf = gdf[gdf.is_valid]`
|
|
341
|
+
4. **Handle missing data**: `gdf['geometry'] = gdf['geometry'].fillna(None)`
|
|
342
|
+
5. **Use efficient formats**: GeoPackage > Shapefile, Parquet for large data
|
|
343
|
+
6. **Apply cloud masking** to optical imagery
|
|
344
|
+
7. **Preserve lineage** for reproducible research
|
|
345
|
+
8. **Use appropriate resolution** for your analysis scale
|
|
346
|
+
|
|
347
|
+
## Detailed Documentation
|
|
348
|
+
|
|
349
|
+
- **[Coordinate Systems](references/coordinate-systems.md)** - CRS fundamentals, UTM, transformations
|
|
350
|
+
- **[Core Libraries](references/core-libraries.md)** - GDAL, Rasterio, GeoPandas, Shapely
|
|
351
|
+
- **[Remote Sensing](references/remote-sensing.md)** - Satellite missions, spectral indices, SAR
|
|
352
|
+
- **[Machine Learning](references/machine-learning.md)** - Deep learning, CNNs, GNNs for RS
|
|
353
|
+
- **[GIS Software](references/gis-software.md)** - QGIS, ArcGIS, GRASS integration
|
|
354
|
+
- **[Scientific Domains](references/scientific-domains.md)** - Marine, hydrology, agriculture, forestry
|
|
355
|
+
- **[Advanced GIS](references/advanced-gis.md)** - 3D GIS, spatiotemporal, topology
|
|
356
|
+
- **[Big Data](references/big-data.md)** - Distributed processing, GPU acceleration
|
|
357
|
+
- **[Industry Applications](references/industry-applications.md)** - Urban planning, disaster management
|
|
358
|
+
- **[Programming Languages](references/programming-languages.md)** - Python, R, Julia, JS, C++, Java, Go, Rust
|
|
359
|
+
- **[Data Sources](references/data-sources.md)** - Satellite catalogs, APIs
|
|
360
|
+
- **[Troubleshooting](references/troubleshooting.md)** - Common issues, debugging, error reference
|
|
361
|
+
- **[Code Examples](references/code-examples.md)** - 500+ examples
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
**GeoMaster covers everything from basic GIS operations to advanced remote sensing and machine learning.**
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: get-available-resources
|
|
3
|
+
description: This skill should be used at the start of any computationally intensive scientific task to detect and report available system resources (CPU cores, GPUs, memory, disk space). It creates a JSON file with resource information and strategic recommendations that inform computational approach decisions such as whether to use parallel processing (joblib, multiprocessing), out-of-core computing (Dask, Zarr), GPU acceleration (PyTorch, JAX), or memory-efficient strategies. Use this skill before running analyses, training models, processing large datasets, or any task where resource constraints matter.
|
|
4
|
+
license: MIT license
|
|
5
|
+
metadata:
|
|
6
|
+
skill-author: K-Dense Inc.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Get Available Resources
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Detect available computational resources and generate strategic recommendations for scientific computing tasks. This skill automatically identifies CPU capabilities, GPU availability (NVIDIA CUDA, AMD ROCm, Apple Silicon Metal), memory constraints, and disk space to help make informed decisions about computational approaches.
|
|
14
|
+
|
|
15
|
+
## When to Use This Skill
|
|
16
|
+
|
|
17
|
+
Use this skill proactively before any computationally intensive task:
|
|
18
|
+
|
|
19
|
+
- **Before data analysis**: Determine if datasets can be loaded into memory or require out-of-core processing
|
|
20
|
+
- **Before model training**: Check if GPU acceleration is available and which backend to use
|
|
21
|
+
- **Before parallel processing**: Identify optimal number of workers for joblib, multiprocessing, or Dask
|
|
22
|
+
- **Before large file operations**: Verify sufficient disk space and appropriate storage strategies
|
|
23
|
+
- **At project initialization**: Understand baseline capabilities for making architectural decisions
|
|
24
|
+
|
|
25
|
+
**Example scenarios:**
|
|
26
|
+
- "Help me analyze this 50GB genomics dataset" → Use this skill first to determine if Dask/Zarr are needed
|
|
27
|
+
- "Train a neural network on this data" → Use this skill to detect available GPUs and backends
|
|
28
|
+
- "Process 10,000 files in parallel" → Use this skill to determine optimal worker count
|
|
29
|
+
- "Run a computationally intensive simulation" → Use this skill to understand resource constraints
|
|
30
|
+
|
|
31
|
+
## How This Skill Works
|
|
32
|
+
|
|
33
|
+
### Resource Detection
|
|
34
|
+
|
|
35
|
+
The skill runs `scripts/detect_resources.py` to automatically detect:
|
|
36
|
+
|
|
37
|
+
1. **CPU Information**
|
|
38
|
+
- Physical and logical core counts
|
|
39
|
+
- Processor architecture and model
|
|
40
|
+
- CPU frequency information
|
|
41
|
+
|
|
42
|
+
2. **GPU Information**
|
|
43
|
+
- NVIDIA GPUs: Detects via nvidia-smi, reports VRAM, driver version, compute capability
|
|
44
|
+
- AMD GPUs: Detects via rocm-smi
|
|
45
|
+
- Apple Silicon: Detects M1/M2/M3/M4 chips with Metal support and unified memory
|
|
46
|
+
|
|
47
|
+
3. **Memory Information**
|
|
48
|
+
- Total and available RAM
|
|
49
|
+
- Current memory usage percentage
|
|
50
|
+
- Swap space availability
|
|
51
|
+
|
|
52
|
+
4. **Disk Space Information**
|
|
53
|
+
- Total and available disk space for working directory
|
|
54
|
+
- Current usage percentage
|
|
55
|
+
|
|
56
|
+
5. **Operating System Information**
|
|
57
|
+
- OS type (macOS, Linux, Windows)
|
|
58
|
+
- OS version and release
|
|
59
|
+
- Python version
|
|
60
|
+
|
|
61
|
+
### Output Format
|
|
62
|
+
|
|
63
|
+
The skill generates a `.claude_resources.json` file in the current working directory containing:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"timestamp": "2025-10-23T10:30:00",
|
|
68
|
+
"os": {
|
|
69
|
+
"system": "Darwin",
|
|
70
|
+
"release": "25.0.0",
|
|
71
|
+
"machine": "arm64"
|
|
72
|
+
},
|
|
73
|
+
"cpu": {
|
|
74
|
+
"physical_cores": 8,
|
|
75
|
+
"logical_cores": 8,
|
|
76
|
+
"architecture": "arm64"
|
|
77
|
+
},
|
|
78
|
+
"memory": {
|
|
79
|
+
"total_gb": 16.0,
|
|
80
|
+
"available_gb": 8.5,
|
|
81
|
+
"percent_used": 46.9
|
|
82
|
+
},
|
|
83
|
+
"disk": {
|
|
84
|
+
"total_gb": 500.0,
|
|
85
|
+
"available_gb": 200.0,
|
|
86
|
+
"percent_used": 60.0
|
|
87
|
+
},
|
|
88
|
+
"gpu": {
|
|
89
|
+
"nvidia_gpus": [],
|
|
90
|
+
"amd_gpus": [],
|
|
91
|
+
"apple_silicon": {
|
|
92
|
+
"name": "Apple M2",
|
|
93
|
+
"type": "Apple Silicon",
|
|
94
|
+
"backend": "Metal",
|
|
95
|
+
"unified_memory": true
|
|
96
|
+
},
|
|
97
|
+
"total_gpus": 1,
|
|
98
|
+
"available_backends": ["Metal"]
|
|
99
|
+
},
|
|
100
|
+
"recommendations": {
|
|
101
|
+
"parallel_processing": {
|
|
102
|
+
"strategy": "high_parallelism",
|
|
103
|
+
"suggested_workers": 6,
|
|
104
|
+
"libraries": ["joblib", "multiprocessing", "dask"]
|
|
105
|
+
},
|
|
106
|
+
"memory_strategy": {
|
|
107
|
+
"strategy": "moderate_memory",
|
|
108
|
+
"libraries": ["dask", "zarr"],
|
|
109
|
+
"note": "Consider chunking for datasets > 2GB"
|
|
110
|
+
},
|
|
111
|
+
"gpu_acceleration": {
|
|
112
|
+
"available": true,
|
|
113
|
+
"backends": ["Metal"],
|
|
114
|
+
"suggested_libraries": ["pytorch-mps", "tensorflow-metal", "jax-metal"]
|
|
115
|
+
},
|
|
116
|
+
"large_data_handling": {
|
|
117
|
+
"strategy": "disk_abundant",
|
|
118
|
+
"note": "Sufficient space for large intermediate files"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Strategic Recommendations
|
|
125
|
+
|
|
126
|
+
The skill generates context-aware recommendations:
|
|
127
|
+
|
|
128
|
+
**Parallel Processing Recommendations:**
|
|
129
|
+
- **High parallelism (8+ cores)**: Use Dask, joblib, or multiprocessing with workers = cores - 2
|
|
130
|
+
- **Moderate parallelism (4-7 cores)**: Use joblib or multiprocessing with workers = cores - 1
|
|
131
|
+
- **Sequential (< 4 cores)**: Prefer sequential processing to avoid overhead
|
|
132
|
+
|
|
133
|
+
**Memory Strategy Recommendations:**
|
|
134
|
+
- **Memory constrained (< 4GB available)**: Use Zarr, Dask, or H5py for out-of-core processing
|
|
135
|
+
- **Moderate memory (4-16GB available)**: Use Dask/Zarr for datasets > 2GB
|
|
136
|
+
- **Memory abundant (> 16GB available)**: Can load most datasets into memory directly
|
|
137
|
+
|
|
138
|
+
**GPU Acceleration Recommendations:**
|
|
139
|
+
- **NVIDIA GPUs detected**: Use PyTorch, TensorFlow, JAX, CuPy, or RAPIDS
|
|
140
|
+
- **AMD GPUs detected**: Use PyTorch-ROCm or TensorFlow-ROCm
|
|
141
|
+
- **Apple Silicon detected**: Use PyTorch with MPS backend, TensorFlow-Metal, or JAX-Metal
|
|
142
|
+
- **No GPU detected**: Use CPU-optimized libraries
|
|
143
|
+
|
|
144
|
+
**Large Data Handling Recommendations:**
|
|
145
|
+
- **Disk constrained (< 10GB)**: Use streaming or compression strategies
|
|
146
|
+
- **Moderate disk (10-100GB)**: Use Zarr, H5py, or Parquet formats
|
|
147
|
+
- **Disk abundant (> 100GB)**: Can create large intermediate files freely
|
|
148
|
+
|
|
149
|
+
## Usage Instructions
|
|
150
|
+
|
|
151
|
+
### Step 1: Run Resource Detection
|
|
152
|
+
|
|
153
|
+
Execute the detection script at the start of any computationally intensive task:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
python scripts/detect_resources.py
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Optional arguments:
|
|
160
|
+
- `-o, --output <path>`: Specify custom output path (default: `.claude_resources.json`)
|
|
161
|
+
- `-v, --verbose`: Print full resource information to stdout
|
|
162
|
+
|
|
163
|
+
### Step 2: Read and Apply Recommendations
|
|
164
|
+
|
|
165
|
+
After running detection, read the generated `.claude_resources.json` file to inform computational decisions:
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
# Example: Use recommendations in code
|
|
169
|
+
import json
|
|
170
|
+
|
|
171
|
+
with open('.claude_resources.json', 'r') as f:
|
|
172
|
+
resources = json.load(f)
|
|
173
|
+
|
|
174
|
+
# Check parallel processing strategy
|
|
175
|
+
if resources['recommendations']['parallel_processing']['strategy'] == 'high_parallelism':
|
|
176
|
+
n_jobs = resources['recommendations']['parallel_processing']['suggested_workers']
|
|
177
|
+
# Use joblib, Dask, or multiprocessing with n_jobs workers
|
|
178
|
+
|
|
179
|
+
# Check memory strategy
|
|
180
|
+
if resources['recommendations']['memory_strategy']['strategy'] == 'memory_constrained':
|
|
181
|
+
# Use Dask, Zarr, or H5py for out-of-core processing
|
|
182
|
+
import dask.array as da
|
|
183
|
+
# Load data in chunks
|
|
184
|
+
|
|
185
|
+
# Check GPU availability
|
|
186
|
+
if resources['recommendations']['gpu_acceleration']['available']:
|
|
187
|
+
backends = resources['recommendations']['gpu_acceleration']['backends']
|
|
188
|
+
# Use appropriate GPU library based on available backend
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Step 3: Make Informed Decisions
|
|
192
|
+
|
|
193
|
+
Use the resource information and recommendations to make strategic choices:
|
|
194
|
+
|
|
195
|
+
**For data loading:**
|
|
196
|
+
```python
|
|
197
|
+
memory_available_gb = resources['memory']['available_gb']
|
|
198
|
+
dataset_size_gb = 10
|
|
199
|
+
|
|
200
|
+
if dataset_size_gb > memory_available_gb * 0.5:
|
|
201
|
+
# Dataset is large relative to memory, use Dask
|
|
202
|
+
import dask.dataframe as dd
|
|
203
|
+
df = dd.read_csv('large_file.csv')
|
|
204
|
+
else:
|
|
205
|
+
# Dataset fits in memory, use pandas
|
|
206
|
+
import pandas as pd
|
|
207
|
+
df = pd.read_csv('large_file.csv')
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**For parallel processing:**
|
|
211
|
+
```python
|
|
212
|
+
from joblib import Parallel, delayed
|
|
213
|
+
|
|
214
|
+
n_jobs = resources['recommendations']['parallel_processing'].get('suggested_workers', 1)
|
|
215
|
+
|
|
216
|
+
results = Parallel(n_jobs=n_jobs)(
|
|
217
|
+
delayed(process_function)(item) for item in data
|
|
218
|
+
)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**For GPU acceleration:**
|
|
222
|
+
```python
|
|
223
|
+
import torch
|
|
224
|
+
|
|
225
|
+
if 'CUDA' in resources['gpu']['available_backends']:
|
|
226
|
+
device = torch.device('cuda')
|
|
227
|
+
elif 'Metal' in resources['gpu']['available_backends']:
|
|
228
|
+
device = torch.device('mps')
|
|
229
|
+
else:
|
|
230
|
+
device = torch.device('cpu')
|
|
231
|
+
|
|
232
|
+
model = model.to(device)
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Dependencies
|
|
236
|
+
|
|
237
|
+
The detection script requires the following Python packages:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
uv pip install psutil
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
All other functionality uses Python standard library modules (json, os, platform, subprocess, sys, pathlib).
|
|
244
|
+
|
|
245
|
+
## Platform Support
|
|
246
|
+
|
|
247
|
+
- **macOS**: Full support including Apple Silicon (M1/M2/M3/M4) GPU detection
|
|
248
|
+
- **Linux**: Full support including NVIDIA (nvidia-smi) and AMD (rocm-smi) GPU detection
|
|
249
|
+
- **Windows**: Full support including NVIDIA GPU detection
|
|
250
|
+
|
|
251
|
+
## Best Practices
|
|
252
|
+
|
|
253
|
+
1. **Run early**: Execute resource detection at the start of projects or before major computational tasks
|
|
254
|
+
2. **Re-run periodically**: System resources change over time (memory usage, disk space)
|
|
255
|
+
3. **Check before scaling**: Verify resources before scaling up parallel workers or data sizes
|
|
256
|
+
4. **Document decisions**: Keep the `.claude_resources.json` file in project directories to document resource-aware decisions
|
|
257
|
+
5. **Use with versioning**: Different machines have different capabilities; resource files help maintain portability
|
|
258
|
+
|
|
259
|
+
## Troubleshooting
|
|
260
|
+
|
|
261
|
+
**GPU not detected:**
|
|
262
|
+
- Ensure GPU drivers are installed (nvidia-smi, rocm-smi, or system_profiler for Apple Silicon)
|
|
263
|
+
- Check that GPU utilities are in system PATH
|
|
264
|
+
- Verify GPU is not in use by other processes
|
|
265
|
+
|
|
266
|
+
**Script execution fails:**
|
|
267
|
+
- Ensure psutil is installed: `uv pip install psutil`
|
|
268
|
+
- Check Python version compatibility (Python 3.6+)
|
|
269
|
+
- Verify script has execute permissions: `chmod +x scripts/detect_resources.py`
|
|
270
|
+
|
|
271
|
+
**Inaccurate memory readings:**
|
|
272
|
+
- Memory readings are snapshots; actual available memory changes constantly
|
|
273
|
+
- Close other applications before detection for accurate "available" memory
|
|
274
|
+
- Consider running detection multiple times and averaging results
|
|
275
|
+
|