Permian methane survey coverage, April 30 to May 17, 2024 The calculation below is the coverage portion of the accepted analysis. Each input line gives a local filename, its public data URL and a SHA-256 digest. Save the four files under the listed names in the same directory as the script and run the Python 3 code there. It uses the standard library. Expected output scenes, days 272 13 all sites ([61, 32], '2024-05-17', [29, 29], 47.54, 0) April 30 [61, 2] The final zero counts dates that covered all listed locations in both areas. # input sources-2021.json https://services6.arcgis.com/HJzJQeO8rbTv2jiF/arcgis/rest/services/Summer_2021_Sources__CarbonMapper/FeatureServer/0/query?where=1%3D1&outFields=source_id,source_lat,source_lon,number_overflights,source_persistence,qsource,number_detections&returnGeometry=false&orderByFields=OBJECTID&f=json sha256:0882fec5f0e10c43bb306898b1d5ae60de64ffe4d5c05d9821136dec668225f0 # input scenes-perm.geojson https://zenodo.org/records/17862304/files/scenes_2024-07-09T23_38_06.614Z.geojson sha256:5be466923c327d60578f83f87e0c6082e059ed319b61c454f9d1c20175d44534 # input E-2024.geojson https://zenodo.org/records/17862304/files/NM%20Permian%202024%20-%20E.geojson sha256:dda4a4b092bb0cf622cdd3d037ff33f10275aec8c076ad3d7e94cbace6d16701 # input W-2024.geojson https://zenodo.org/records/17862304/files/NM%20Permian%202024%20-%20W.geojson sha256:f77088b96a9f1bc4f022f8b4650ec93b64b7cb32622aa50f37893760a1dc768a # expect: 47.54 from collections import defaultdict import json from pathlib import Path def features(name): return json.loads((Path('.') / name).read_text())['features'] def inside_ring(x, y, ring): inside = False for a, b in zip(ring, ring[1:]): if (a[1] > y) != (b[1] > y): crossing = a[0] + (y-a[1]) * (b[0]-a[0]) / (b[1]-a[1]) if x < crossing: inside = not inside return inside sites = {f['attributes']['source_id']: f['attributes'] for f in features('sources-2021.json')} def covered(feature): geom = feature['geometry'] polys = geom['coordinates'] if geom['type'] == 'Polygon': polys = [polys] else: assert geom['type'] == 'MultiPolygon' result = set() for outer, *holes in polys: xs, ys, *_ = zip(*outer) left, right, bottom, top = min(xs), max(xs), min(ys), max(ys) for sid, site in sites.items(): x, y = site['source_lon'], site['source_lat'] if left <= x <= right and bottom <= y <= top: if inside_ring(x, y, outer) and not any(inside_ring(x, y, h) for h in holes): result.add(sid) return result boxes = [covered(features(k+'-2024.geojson')[0]) for k in ('E', 'W')] scenes = sorted(features('scenes-perm.geojson'), key=lambda f: f['properties']['timestamp']) daily = defaultdict(set) for feature in scenes: day = feature['properties']['timestamp'][:10] daily[day].update(covered(feature)) def box_result(eligible): groups = [box & eligible for box in boxes] rows = [] for day, seen in daily.items(): counts = [len(group & seen) for group in groups] worst = min(n/len(group) for n, group in zip(counts, groups)) rows.append((worst, day, counts)) best, day, counts = max(rows) return [len(g) for g in groups], day, counts, round(100*best, 2), sum(r[0] == 1 for r in rows) print('scenes, days', len(scenes), len(daily)) print('all sites', box_result(set(sites))) print('April 30', [len(group & daily['2024-04-30']) for group in boxes])