Sync reproducible research release, batch 1/6
Browse files- README.md +29 -0
- THIRD_PARTY_DATA.md +32 -0
- analysis/audit_china_patch_sites.py +52 -0
- analysis/audit_gce_longterm.py +78 -0
- analysis/download_mechanism_sources.py +86 -0
- analysis/reanalyze_gsm_competition.py +89 -0
- data/derived/china_patch_traits_20261007/audit.json +17 -0
- data/derived/china_patch_traits_20261007/published_site_context.pdf +0 -0
- data/derived/china_patch_traits_20261007/published_site_context.png +3 -0
- data/derived/china_patch_traits_20261007/published_site_context.svg +655 -0
- data/derived/china_patch_traits_20261007/published_sites_and_overlap_screen.csv +11 -0
- data/derived/gsm_competition_20261007/all_raster_class_areas.csv +9 -0
README.md
CHANGED
|
@@ -123,3 +123,32 @@ responses are not archived in this release. The manuscript remains a working
|
|
| 123 |
draft with independent validation incomplete. New core figures use 183 mm
|
| 124 |
width, editable vector text and separately saved source data. Review exports
|
| 125 |
place figures and their legends together.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
draft with independent validation incomplete. New core figures use 183 mm
|
| 124 |
width, editable vector text and separately saved source data. Review exports
|
| 125 |
place figures and their legends together.
|
| 126 |
+
|
| 127 |
+
### Additional external data (7 October 2026)
|
| 128 |
+
|
| 129 |
+
The [external-data expansion report](docs/EXTERNAL_DATA_EXPANSION_2026-10-07.md)
|
| 130 |
+
documents a complete 2.08 GB marsh imagery/competition archive, 24 years of GCE
|
| 131 |
+
plant monitoring with soil data, and published summaries from ten Chinese coastal
|
| 132 |
+
sites. It distinguishes source records, repeated measurements, geographic overlap
|
| 133 |
+
and independent validation. [GSM figure](data/derived/gsm_competition_20261007/gsm_external_evidence.png)
|
| 134 |
+
and [Chinese site context](data/derived/china_patch_traits_20261007/published_site_context.png)
|
| 135 |
+
have PDF/SVG counterparts and source tables. Three large original GSM rasters are
|
| 136 |
+
on [Hugging Face](https://huggingface.co/datasets/cyd0806/spartina-ai-eco-evolution-data/tree/main/external_sources/gsm_competition_20261007),
|
| 137 |
+
with verified hashes. GCE originals and new numerical analyses remain local
|
| 138 |
+
pending reconciliation of provider terms.
|
| 139 |
+
|
| 140 |
+
```bash
|
| 141 |
+
# All 19 GSM files: ~2.08 GB; optional MICAO_DOWNLOAD_PROXY for Figshare.
|
| 142 |
+
python analysis/download_mechanism_sources.py --dataset gsm --output /path/to/gsm_source
|
| 143 |
+
python analysis/reanalyze_gsm_competition.py --source /path/to/gsm_source --output data/derived/gsm_competition_20261007
|
| 144 |
+
# Published Chinese supplement and full Methods are already archived.
|
| 145 |
+
python analysis/audit_china_patch_sites.py --source external_data/china_patch_traits_20261007 --output data/derived/china_patch_traits_20261007
|
| 146 |
+
# GCE download uses GCE_REGISTRATION_NAME and GCE_REGISTRATION_EMAIL.
|
| 147 |
+
# Keep both directories outside the public release.
|
| 148 |
+
python analysis/download_mechanism_sources.py --dataset gce --output /path/to/local_gce_source
|
| 149 |
+
python analysis/audit_gce_longterm.py --source /path/to/local_gce_source --output /path/to/local_gce_analysis
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
The China source downloader (`--dataset china`) verifies archived SHA-256 values;
|
| 153 |
+
if the publisher changes its XML snapshot, use the reviewed copy here or review
|
| 154 |
+
and document the new version before updating the pinned hash.
|
THIRD_PARTY_DATA.md
CHANGED
|
@@ -57,3 +57,35 @@ is deferred until this discrepancy is resolved. No messages to authors were sent
|
|
| 57 |
Source metadata and contributor names remain attached. EDI metadata discovery
|
| 58 |
and GCE original-file downloads are distinguished; no byte equivalence between
|
| 59 |
repository revisions has been established.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
Source metadata and contributor names remain attached. EDI metadata discovery
|
| 58 |
and GCE original-file downloads are distinguished; no byte equivalence between
|
| 59 |
repository revisions has been established.
|
| 60 |
+
|
| 61 |
+
GSM competition and remote-sensing archive: Yuyang Wang, Ivan Valiela and
|
| 62 |
+
Kelsey Chenoweth, Figshare v1, https://doi.org/10.6084/m9.figshare.30068944.v1.
|
| 63 |
+
Dataset licence **CC-BY-4.0**; associated paper
|
| 64 |
+
https://doi.org/10.1016/j.envc.2026.101453 has separate article terms.
|
| 65 |
+
All 19 originals were provider-MD5 verified. Sixteen small originals and metadata
|
| 66 |
+
are in `external_data/gsm_competition_20261007/`; three unchanged rasters are on
|
| 67 |
+
Hugging Face under `external_sources/gsm_competition_20261007/`, with the manifest
|
| 68 |
+
in both releases. Our adaptations in `data/derived/gsm_competition_20261007/`
|
| 69 |
+
retain attribution and CC-BY-4.0. The authors have not endorsed our analyses.
|
| 70 |
+
|
| 71 |
+
GCE-LTER long-term monitoring: Steven C. Pennings, PLT-GCES-1609 (2016), v7.0,
|
| 72 |
+
https://doi.org/10.6073/pasta/935872ae9b32d59d2c59b26856f0ea95; and
|
| 73 |
+
POR-GCES-2106 (2021), v4.0,
|
| 74 |
+
https://doi.org/10.6073/pasta/89075cf18fa3761b0cb17646845e5ab9. Georgia Coastal
|
| 75 |
+
Ecosystems LTER Project, University of Georgia. Only metadata, provenance and
|
| 76 |
+
our scripts are released. Raw tables and newly computed numerical results remain
|
| 77 |
+
local because EML CC-BY-4.0 and legacy portal redistribution/notification terms
|
| 78 |
+
differ. No notifications to authors were sent. The derived biomass and flowering
|
| 79 |
+
summaries overlap with the original observation table and are not extra samples.
|
| 80 |
+
|
| 81 |
+
Chinese coastal patch traits: Yiwen Liu, Qian Dong, Ziyu Zheng, Wensi Hu,
|
| 82 |
+
Yuxiang Li, Chi Xu and Shuqing N. Teng (2026), *Environmental stress and
|
| 83 |
+
plant-plant interactions jointly shape intertidal cordgrass traits across broad
|
| 84 |
+
spatial scales*, https://doi.org/10.3389/fpls.2026.1913369; supplement
|
| 85 |
+
https://doi.org/10.3389/fpls.2026.1913369.s001, Figshare 33251937, file 67534884.
|
| 86 |
+
Article XML and supplement **CC-BY-4.0**, archived in
|
| 87 |
+
`external_data/china_patch_traits_20261007/`. Our table extraction, area
|
| 88 |
+
conversions, overlap screen and plots in `data/derived/china_patch_traits_20261007/`
|
| 89 |
+
are adaptations under the same attribution and licence; not endorsed by the
|
| 90 |
+
source authors. Only published aggregate data are included. Raw imagery and
|
| 91 |
+
individual trait measurements were not acquired.
|
analysis/audit_china_patch_sites.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Extract published ten-site summaries and screen geographic overlap, not sample independence."""
|
| 2 |
+
import argparse,json,hashlib
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
import pandas as pd
|
| 5 |
+
import numpy as np
|
| 6 |
+
import matplotlib
|
| 7 |
+
matplotlib.use('Agg')
|
| 8 |
+
import matplotlib.pyplot as plt
|
| 9 |
+
from docx import Document
|
| 10 |
+
|
| 11 |
+
def main():
|
| 12 |
+
ap=argparse.ArgumentParser(description=__doc__);ap.add_argument('--source',type=Path,required=True);ap.add_argument('--output',type=Path,required=True);a=ap.parse_args();a.output.mkdir(parents=True,exist_ok=True)
|
| 13 |
+
manifest=json.loads((a.source/'manifest.json').read_text());raw=(a.source/'supplement.docx').read_bytes();assert hashlib.md5(raw).hexdigest()==manifest['file']['computed_md5']
|
| 14 |
+
doc=Document(a.source/'supplement.docx');table=doc.tables[0];rows=[[c.text.strip() for c in r.cells] for r in table.rows];assert len(rows)==11 and len(rows[0])==9
|
| 15 |
+
names=['region','site','longitude','latitude','resolution_m','low_patch_count','low_cover_fraction','high_patch_count','high_cover_fraction'];d=pd.DataFrame(rows[1:],columns=names)
|
| 16 |
+
for col in names[2:]:d[col]=pd.to_numeric(d[col])
|
| 17 |
+
assert d.site.is_unique and d[['low_cover_fraction','high_cover_fraction']].ge(0).all().all() and d[['low_cover_fraction','high_cover_fraction']].le(1).all().all()
|
| 18 |
+
methods=json.loads((a.source/'methods_verified.json').read_text())
|
| 19 |
+
assert hashlib.sha256((a.source/'article.xml').read_bytes()).hexdigest()==methods['sha256']
|
| 20 |
+
d['campaign_month']=d.region.map(methods['campaign_month_by_region']);assert d.campaign_month.notna().all()
|
| 21 |
+
d['window_area_m2']=methods['uav_window_width_m']*methods['uav_window_height_m']
|
| 22 |
+
for tide in ['low','high']:
|
| 23 |
+
d[tide+'_patch_density_per_1000_m2']=d[tide+'_patch_count']/d.window_area_m2*1000
|
| 24 |
+
d[tide+'_covered_area_m2_approx']=d[tide+'_cover_fraction']*d.window_area_m2
|
| 25 |
+
west,south,east,north=117.404195622047,23.9134768474132,117.432930102047,23.9374309174132
|
| 26 |
+
d['nominal_point_in_local_image']=d.longitude.between(west,east)&d.latitude.between(south,north)
|
| 27 |
+
# Coordinates printed to 0.01 degrees. This interval is a rounding screen,
|
| 28 |
+
# not a confidence region or proof of shared imagery/material.
|
| 29 |
+
d['rounded_coordinate_cell_intersects_local_image']=(d.longitude+.005>=west)&(d.longitude-.005<=east)&(d.latitude+.005>=south)&(d.latitude-.005<=north)
|
| 30 |
+
d.to_csv(a.output/'published_sites_and_overlap_screen.csv',index=False)
|
| 31 |
+
audit={'source_doi':manifest['doi'],'paper_doi':manifest['article_doi'],'published_sites':len(d),'site_tidal_cells':2*len(d),'window_area_m2':2500,'raw_images_acquired':False,'individual_trait_records_acquired':False,'nominal_overlapping_sites':d.loc[d.nominal_point_in_local_image,'site'].tolist(),'coordinate_resolution_degrees':.01,'interpretation':'Site10 nominal coordinates fall within the local aerial footprint. Its September 2025 campaign is later than our 2014–2021 imagery. Coordinate rounding does not establish shared plots or image footprints. Treat as a potential temporal extension, not independent spatial validation. Densities use the 50 by 50 m windows documented in Methods. Covered areas inherit rounding of published cover fractions.','raw_data_availability':'Author request; no openly linked raw-data repository identified in full-text availability statement. No authors contacted.','confounding':'Province, campaign season and year are confounded; this table cannot identify latitude effects independently of sampling season/year.','table_scope':'Supplement Table S1 site-level aggregates; no individual trait data or new trait-effect estimation.'}
|
| 32 |
+
(a.output/'audit.json').write_text(json.dumps(audit,indent=2));print(json.dumps(audit,indent=2))
|
| 33 |
+
plt.rcParams.update({'font.family':'DejaVu Sans','font.size':8,'pdf.fonttype':42,'svg.fonttype':'none','axes.spines.top':False,'axes.spines.right':False})
|
| 34 |
+
fig,axes=plt.subplots(1,2,figsize=(7.2,4.5),sharey=True)
|
| 35 |
+
y=np.arange(len(d));labels=[f"{r.site} · {r.region} ({r.campaign_month})" for r in d.itertuples()]
|
| 36 |
+
for ax,metric,title in zip(axes,['patch_density_per_1000_m2','cover_fraction'],['Patch density (per 1,000 m²)','Vegetation cover (%)']):
|
| 37 |
+
scale=100 if metric=='cover_fraction' else 1
|
| 38 |
+
low=d['low_'+metric]*scale;high=d['high_'+metric]*scale
|
| 39 |
+
ax.hlines(y,low,high,color='#b8b8b8',lw=1,zorder=1)
|
| 40 |
+
ax.scatter(low,y,c='#0072B2',s=22,label='Low tidal position',zorder=2)
|
| 41 |
+
ax.scatter(high,y,c='#D55E00',marker='s',s=20,label='High tidal position',zorder=2)
|
| 42 |
+
ax.set_xlabel(title);ax.set_xlim(left=0);ax.grid(axis='x',alpha=.15)
|
| 43 |
+
axes[0].set_yticks(y,labels);axes[0].invert_yaxis()
|
| 44 |
+
axes[0].get_yticklabels()[-1].set_fontweight('bold')
|
| 45 |
+
axes[1].legend(loc='lower right',frameon=False,fontsize=7)
|
| 46 |
+
for label,ax in zip('ab',axes):ax.text(-.04,1.04,label,transform=ax.transAxes,fontweight='bold',fontsize=11)
|
| 47 |
+
fig.suptitle('Published site summaries · one 50 × 50 m window per tidal position',fontsize=9)
|
| 48 |
+
fig.text(.02,.02,'Site10: nominal geographic overlap with local imagery; later campaign. Lines pair tidal positions, not trajectories.',fontsize=7)
|
| 49 |
+
fig.tight_layout(rect=(0,.065,1,.96))
|
| 50 |
+
for ext in ['png','pdf','svg']:fig.savefig(a.output/f'published_site_context.{ext}',dpi=300)
|
| 51 |
+
plt.close(fig)
|
| 52 |
+
if __name__=='__main__':main()
|
analysis/audit_gce_longterm.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Audit GCE long-term observations and exact soil joins; keep results local.
|
| 2 |
+
|
| 3 |
+
Biomass is calculated from height and is excluded from response modelling.
|
| 4 |
+
Density-size associations are descriptive, not a demonstrated self-thinning law.
|
| 5 |
+
"""
|
| 6 |
+
import argparse,hashlib,json
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
import numpy as np
|
| 9 |
+
import pandas as pd
|
| 10 |
+
from scipy.io import loadmat
|
| 11 |
+
import matplotlib
|
| 12 |
+
matplotlib.use('Agg')
|
| 13 |
+
import matplotlib.pyplot as plt
|
| 14 |
+
|
| 15 |
+
def fit_slope(d,environment=False):
|
| 16 |
+
frame=d[['Year','Site','Zone']].astype(str)
|
| 17 |
+
groups=pd.get_dummies(frame.Site+'_'+frame.Zone,drop_first=True,dtype=float)
|
| 18 |
+
years=pd.get_dummies(frame.Year,drop_first=True,dtype=float)
|
| 19 |
+
x=np.column_stack([np.ones(len(d)),np.log(d.density),groups,years])
|
| 20 |
+
if environment:x=np.column_stack([x,d.Soil_Salinity_Porewater])
|
| 21 |
+
coef=np.linalg.lstsq(x,np.log(d.mean_height),rcond=None)[0]
|
| 22 |
+
return float(coef[1]),float(coef[-1]) if environment else None
|
| 23 |
+
|
| 24 |
+
def main():
|
| 25 |
+
ap=argparse.ArgumentParser(description=__doc__);ap.add_argument('--source',type=Path,required=True);ap.add_argument('--output',type=Path,required=True);a=ap.parse_args();out=a.output;out.mkdir(parents=True,exist_ok=True)
|
| 26 |
+
manifest=json.loads((a.source/'download_manifest.json').read_text())
|
| 27 |
+
for file in manifest['files']:
|
| 28 |
+
assert hashlib.sha256((a.source/file['name']).read_bytes()).hexdigest()==file['sha256']
|
| 29 |
+
if file['name'].endswith('.CSV'):
|
| 30 |
+
assert len(pd.read_csv(a.source/file['name'],skiprows=[0,1,3,4]))==file['expected_records']
|
| 31 |
+
raw=loadmat(a.source/'PLT-GCES-1609_Observations_7_0_VARS.MAT',simplify_cells=True)
|
| 32 |
+
def scalar(v):return None if isinstance(v,np.ndarray) and v.size==0 else v
|
| 33 |
+
data={k:[scalar(v) for v in values] for k,values in raw.items() if not k.startswith('__') and k!='metadata'}
|
| 34 |
+
assert {len(v) for v in data.values()}=={75236}
|
| 35 |
+
allobs=pd.DataFrame(data);allobs.to_csv(out/'observations_decoded.csv.gz',index=False,compression='gzip')
|
| 36 |
+
allobs.groupby(['Year','Species'],dropna=False).size().rename('records').to_csv(out/'year_species_inventory.csv')
|
| 37 |
+
d=allobs[allobs.Species_Code=='A1'].copy();keys=['Year','Site','Zone','Plot']
|
| 38 |
+
assert d.groupby(keys).Quadrat_Area.nunique().eq(1).all()
|
| 39 |
+
assert d.groupby(keys).Location.nunique().eq(1).all()
|
| 40 |
+
group=d.groupby(keys).agg(record_n=('Shoot_Height','size'),height_n=('Shoot_Height','count'),mean_height=('Shoot_Height','mean'),max_height=('Shoot_Height','max'),area=('Quadrat_Area','first'),Location=('Location','first'),disturbed=('Plot_Disturbance','max'),plot_flag=('Flag_Plot','max'),location_flag=('Flag_Location','max'),flowering_n=('Flowering_Status','sum'),flower_scored_n=('Flowering_Status','count')).reset_index()
|
| 41 |
+
group['density']=group.height_n/group.area
|
| 42 |
+
table=pd.read_csv(a.source/'PLT-GCES-1609_Shoots_Flowering_7_0.CSV',skiprows=[0,1,3,4]);table=table[table.Species_Code=='A1']
|
| 43 |
+
joined=group.merge(table,on=keys,validate='one_to_one');assert len(joined)==len(group)==len(table)==3093
|
| 44 |
+
density_error=float(np.max(np.abs(joined.density-joined.Num_Shoots_m2)));assert density_error==0
|
| 45 |
+
# Flower counts require their own valid-scoring denominator; do not call NaN nonflowering.
|
| 46 |
+
group['flowering_fraction']=group.flowering_n/group.flower_scored_n.replace(0,np.nan)
|
| 47 |
+
group.to_csv(out/'spartina_plot_years.csv',index=False)
|
| 48 |
+
env=pd.read_csv(a.source/'POR-GCES-2106_4_0.CSV',skiprows=[0,1,3,4]);assert len(env)==1308
|
| 49 |
+
assert not env.duplicated(['Year','Location']).any()
|
| 50 |
+
keep=['Year','Location','Soil_Salinity_Porewater','Flag_Soil_Salinity_Porewater','Flag_Location']
|
| 51 |
+
ambiguous=group.duplicated(['Year','Location'],keep=False)
|
| 52 |
+
group[ambiguous].to_csv(out/'ambiguous_year_location_keys.csv',index=False)
|
| 53 |
+
merged=group[~ambiguous].merge(env[keep],on=['Year','Location'],how='left',validate='one_to_one',indicator=True)
|
| 54 |
+
merged.to_csv(out/'spartina_soil_exact_join.csv',index=False)
|
| 55 |
+
valid=group[(group.mean_height>0)&(group.density>0)&(group.Zone>0)].copy()
|
| 56 |
+
fitted=[]
|
| 57 |
+
for name,sub in [('all_observed',valid),('undisturbed',valid[valid.disturbed==0]),('plot_and_location_unflagged',valid[(valid.plot_flag==0)&(valid.location_flag==0)])]:
|
| 58 |
+
slope,_=fit_slope(sub);fitted.append(dict(scenario=name,n_plot_years=len(sub),n_sites=sub.Site.nunique(),density_slope=slope,salinity_slope=np.nan))
|
| 59 |
+
for site in sorted(valid.Site.unique()):
|
| 60 |
+
sub=valid[valid.Site!=site];slope,_=fit_slope(sub);fitted.append(dict(scenario=f'leave_site_{site}_out',n_plot_years=len(sub),n_sites=sub.Site.nunique(),density_slope=slope,salinity_slope=np.nan))
|
| 61 |
+
environmental=merged[(merged.mean_height>0)&(merged.density>0)&(merged.Zone>0)&merged.Soil_Salinity_Porewater.notna()&merged.Flag_Soil_Salinity_Porewater.isna()].copy()
|
| 62 |
+
slope,salt=fit_slope(environmental,True);fitted.append(dict(scenario='exact_soil_join_unflagged_salinity',n_plot_years=len(environmental),n_sites=environmental.Site.nunique(),density_slope=slope,salinity_slope=salt));pd.DataFrame(fitted).to_csv(out/'descriptive_density_size_associations.csv',index=False)
|
| 63 |
+
# A conservative temporal table: positive observed plots only, no fabricated absences.
|
| 64 |
+
yearly=valid.groupby(['Year','Site']).agg(mean_height=('mean_height','mean'),mean_density=('density','mean'),n_plots=('Plot','size')).reset_index();yearly.to_csv(out/'site_year_means.csv',index=False)
|
| 65 |
+
audit={'source_rows':len(allobs),'years':[int(allobs.Year.min()),int(allobs.Year.max())],'source_sites':int(allobs.Site.nunique()),'spartina_rows':len(d),'spartina_nonmissing_height':int(d.Shoot_Height.notna().sum()),'spartina_plot_years':len(group),'positive_height_density_plot_years':len(valid),'spartina_sites':int(d.Site.nunique()),'density_table_max_error':density_error,'soil_rows':len(env),'soil_years':[int(env.Year.min()),int(env.Year.max())],'ambiguous_location_plot_years_excluded_from_soil_join':int(ambiguous.sum()),'exact_soil_join_rows':int((merged._merge=='both').sum()),'usable_unflagged_soil_join_rows':len(environmental),'recorded_heights_at_or_below_10_cm':int(d.Shoot_Height.le(10).sum()),'limitations':['Native-range monitoring, not an invasive-range replication.','Stem observations are repeated cross-sectional samples, not individually tracked genets.','Number of stems with observed height divided by quadrat area reproduces all 3093 published density summaries; missing height rows must not be counted as live stems.','Locations may be estimated from replacement plots; supplied flags retained and unflagged sensitivity reported.','Protocol states live shoots above 10 cm, but some recorded heights are at or below 10 cm. Raw values retained, discrepancy recorded.','Density-size coefficients adjust for site-by-zone and year categories; no causal thinning rate, genetic effect, P value or confidence interval is claimed.','Biomass is allometrically derived from shoot height/flowering; excluded to avoid circular validation.','Soil links exclude all ambiguous Year+Location keys before matching; no spatial imputation. Nonpositive zone codes are excluded from descriptive regressions.','Original source is CC-BY in EML but legacy portal terms differ; raw and derived numbers remain local.']}
|
| 66 |
+
(out/'audit.json').write_text(json.dumps(audit,indent=2))
|
| 67 |
+
plt.rcParams.update({'font.family':'DejaVu Sans','font.size':7,'axes.titlesize':7,'axes.labelsize':7,'axes.spines.top':False,'axes.spines.right':False,'pdf.fonttype':42,'svg.fonttype':'none','lines.linewidth':1})
|
| 68 |
+
fig,axs=plt.subplots(2,2,figsize=(183/25.4,135/25.4),layout='constrained')
|
| 69 |
+
matrix=group.groupby(['Site','Year']).size().unstack(fill_value=0);im=axs[0,0].imshow(matrix,aspect='auto',cmap='Blues');axs[0,0].set(yticks=range(len(matrix)),yticklabels=matrix.index,xticks=[0,5,10,15,20,23],xticklabels=[2000,2005,2010,2015,2020,2023],ylabel='Site',xlabel='Year');axs[0,0].set_title('Observed Spartina plot-years',loc='left');fig.colorbar(im,ax=axs[0,0],label='Plot count')
|
| 70 |
+
axs[0,1].scatter(valid.density,valid.mean_height,s=3,alpha=.25,color='#0072B2');axs[0,1].set(xscale='log',yscale='log',xlabel='Recorded stem density (m⁻²)',ylabel='Mean shoot height (cm)');axs[0,1].set_title('Size–density observations',loc='left')
|
| 71 |
+
for site,g in yearly.groupby('Site'):axs[1,0].plot(g.Year,g.mean_height,lw=.7,alpha=.7,label=str(site))
|
| 72 |
+
axs[1,0].set(xlabel='Year',ylabel='Mean plot height (cm)');axs[1,0].set_title('Within-site annual summaries',loc='left')
|
| 73 |
+
axs[1,0].legend(title='Site',fontsize=5,title_fontsize=5,ncol=3,loc='upper left',framealpha=.85)
|
| 74 |
+
axs[1,1].scatter(environmental.Soil_Salinity_Porewater,environmental.mean_height,s=5,alpha=.35,color='#009E73');axs[1,1].set(xlabel='Soil porewater salinity (dimensionless)',ylabel='Mean shoot height (cm)');axs[1,1].set_title('Exact plot-year soil matches',loc='left')
|
| 75 |
+
for letter,ax in zip('abcd',axs.flat):ax.text(-.1,1.04,letter,transform=ax.transAxes,fontweight='bold',fontsize=8)
|
| 76 |
+
for ext in ['png','pdf','svg']:fig.savefig(out/f'gce_longterm_inventory.{ext}',dpi=300)
|
| 77 |
+
plt.close(fig);print(json.dumps(audit,indent=2));print(pd.DataFrame(fitted).to_string(index=False))
|
| 78 |
+
if __name__=='__main__':main()
|
analysis/download_mechanism_sources.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Download pinned Figshare mechanisms data or documented GCE long-term tables.
|
| 2 |
+
|
| 3 |
+
GSM: complete source archive, CC-BY-4.0, provider MD5 checked per file.
|
| 4 |
+
GCE: original files and derived analyses must stay local pending reconciliation
|
| 5 |
+
of the EML licence with the legacy download agreement. Registration details
|
| 6 |
+
are read from GCE_REGISTRATION_NAME and GCE_REGISTRATION_EMAIL, never saved.
|
| 7 |
+
"""
|
| 8 |
+
import argparse,hashlib,json,os
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
from urllib.parse import urljoin
|
| 11 |
+
import xml.etree.ElementTree as ET
|
| 12 |
+
import requests
|
| 13 |
+
from bs4 import BeautifulSoup
|
| 14 |
+
from download_xmu_common_garden import form_values
|
| 15 |
+
|
| 16 |
+
def digest(path,algorithm):
|
| 17 |
+
h=hashlib.new(algorithm)
|
| 18 |
+
with path.open('rb') as f:
|
| 19 |
+
for chunk in iter(lambda:f.read(4*1024*1024),b''):h.update(chunk)
|
| 20 |
+
return h.hexdigest()
|
| 21 |
+
|
| 22 |
+
def gsm(args):
|
| 23 |
+
session=requests.Session();session.trust_env=False
|
| 24 |
+
proxies={'https':args.proxy,'http':args.proxy} if args.proxy else {}
|
| 25 |
+
r=session.get('https://api.figshare.com/v2/articles/30068944/versions/1',proxies=proxies,timeout=60);r.raise_for_status();meta=r.json();assert meta['version']==1
|
| 26 |
+
(args.output/'figshare_metadata.json').write_text(json.dumps(meta,indent=2))
|
| 27 |
+
rows=[]
|
| 28 |
+
for f in meta['files']:
|
| 29 |
+
target=args.output/f['name']
|
| 30 |
+
if not (target.exists() and target.stat().st_size==f['size'] and digest(target,'md5')==f['computed_md5']):
|
| 31 |
+
temp=target.with_suffix(target.suffix+'.part')
|
| 32 |
+
with session.get(f['download_url'],proxies=proxies,timeout=(30,90),stream=True) as response:
|
| 33 |
+
response.raise_for_status()
|
| 34 |
+
with temp.open('wb') as output:
|
| 35 |
+
for chunk in response.iter_content(4*1024*1024):output.write(chunk)
|
| 36 |
+
if temp.stat().st_size!=f['size'] or digest(temp,'md5')!=f['computed_md5']:raise RuntimeError('Provider checksum mismatch: '+f['name'])
|
| 37 |
+
temp.replace(target)
|
| 38 |
+
rows.append(dict(f,sha256=digest(target,'sha256')));print('Verified',f['name'],flush=True)
|
| 39 |
+
(args.output/'all_files_manifest.json').write_text(json.dumps({'doi':meta['doi'],'paper_doi':'10.1016/j.envc.2026.101453','license':meta['license'],'files':rows,'total_bytes':sum(f['size'] for f in rows),'provider_md5_verified':True},indent=2))
|
| 40 |
+
|
| 41 |
+
def gce(args):
|
| 42 |
+
name=os.environ.get('GCE_REGISTRATION_NAME');email=os.environ.get('GCE_REGISTRATION_EMAIL')
|
| 43 |
+
if not name or not email:raise ValueError('Set GCE_REGISTRATION_NAME and GCE_REGISTRATION_EMAIL')
|
| 44 |
+
session=requests.Session();session.trust_env=False;rows=[]
|
| 45 |
+
base='https://gce-lter.marsci.uga.edu/public/app/'
|
| 46 |
+
for accession in ['PLT-GCES-1609','POR-GCES-2106']:
|
| 47 |
+
r=session.get(base+'send_eml.asp',params={'accession':accession},timeout=60);r.raise_for_status();(args.output/(accession+'.xml')).write_bytes(r.content);root=ET.fromstring(r.content)
|
| 48 |
+
for table in root.findall('.//dataTable'):
|
| 49 |
+
extension='.MAT' if 'Observations' in table.findtext('entityName') else '.CSV'
|
| 50 |
+
url=next(e.text for e in table.findall('.//url') if extension in (e.text or ''))
|
| 51 |
+
filename=url.split('filename=')[1];target=args.output/filename
|
| 52 |
+
if not target.exists():
|
| 53 |
+
response=session.get(url,timeout=60);response.raise_for_status()
|
| 54 |
+
for _ in range(3):
|
| 55 |
+
if 'html' not in response.headers.get('Content-Type',''):break
|
| 56 |
+
form=BeautifulSoup(response.text,'html.parser').find('form')
|
| 57 |
+
if form is None:raise RuntimeError('Missing normal registration form')
|
| 58 |
+
values=form_values(form);values.update(username=name,email=email,affiliation='Academic',notify='0',notify2='0')
|
| 59 |
+
response=session.post(urljoin(response.url,form['action']),data=values,timeout=90);response.raise_for_status()
|
| 60 |
+
if 'html' in response.headers.get('Content-Type',''):raise RuntimeError('HTML is not data; no file saved')
|
| 61 |
+
target.write_bytes(response.content)
|
| 62 |
+
rows.append(dict(accession=accession,name=filename,url=url,expected_records=int(table.findtext('numberOfRecords')),bytes=target.stat().st_size,sha256=digest(target,'sha256')));print('Saved',filename,flush=True)
|
| 63 |
+
(args.output/'download_manifest.json').write_text(json.dumps({'files':rows,'licence_note':'EML CC-BY and legacy download terms differ; keep raw and derived numbers local.','provider_checksums_available':False},indent=2))
|
| 64 |
+
|
| 65 |
+
def china(args):
|
| 66 |
+
# Immutable supplement plus the reviewed article snapshot. Expected digests
|
| 67 |
+
# are pinned in the repository, not learnt from the newly downloaded file.
|
| 68 |
+
pinned=Path(__file__).resolve().parents[1]/'external_data/china_patch_traits_20261007'
|
| 69 |
+
manifest=json.loads((pinned/'manifest.json').read_text())
|
| 70 |
+
methods=json.loads((pinned/'methods_verified.json').read_text())
|
| 71 |
+
session=requests.Session();session.trust_env=False
|
| 72 |
+
proxies={'https':args.proxy,'http':args.proxy} if args.proxy else {}
|
| 73 |
+
for name,url,expected in [('supplement.docx',manifest['file']['download_url'],manifest['sha256']),('article.xml',methods['source_url'],methods['sha256'])]:
|
| 74 |
+
target=args.output/name
|
| 75 |
+
if not (target.exists() and digest(target,'sha256')==expected):
|
| 76 |
+
response=session.get(url,proxies=proxies,timeout=(30,90));response.raise_for_status()
|
| 77 |
+
if hashlib.sha256(response.content).hexdigest()!=expected:raise RuntimeError('Source differs from reviewed snapshot: '+name)
|
| 78 |
+
target.write_bytes(response.content)
|
| 79 |
+
print('Verified',name,flush=True)
|
| 80 |
+
for name in ['manifest.json','methods_verified.json']:
|
| 81 |
+
(args.output/name).write_bytes((pinned/name).read_bytes())
|
| 82 |
+
|
| 83 |
+
def main():
|
| 84 |
+
ap=argparse.ArgumentParser(description=__doc__);ap.add_argument('--dataset',choices=['gsm','gce','china'],required=True);ap.add_argument('--output',type=Path,required=True);ap.add_argument('--proxy',default=os.environ.get('MICAO_DOWNLOAD_PROXY'));args=ap.parse_args();args.output.mkdir(parents=True,exist_ok=True)
|
| 85 |
+
{'gsm':gsm,'gce':gce,'china':china}[args.dataset](args)
|
| 86 |
+
if __name__=='__main__':main()
|
analysis/reanalyze_gsm_competition.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Audit published marsh imagery, stratified reference labels and clipping records.
|
| 2 |
+
|
| 3 |
+
Reference labels are the source authors' interpretation of the same NAIP imagery,
|
| 4 |
+
not independent field truth. Experimental plot assignment is not documented in
|
| 5 |
+
these files; plot contrasts are descriptive.
|
| 6 |
+
"""
|
| 7 |
+
import argparse,json,hashlib
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
import numpy as np
|
| 10 |
+
import pandas as pd
|
| 11 |
+
import rasterio
|
| 12 |
+
from rasterio.vrt import WarpedVRT
|
| 13 |
+
from rasterio.enums import Resampling
|
| 14 |
+
import matplotlib
|
| 15 |
+
matplotlib.use('Agg')
|
| 16 |
+
import matplotlib.pyplot as plt
|
| 17 |
+
from matplotlib.colors import ListedColormap
|
| 18 |
+
|
| 19 |
+
def main():
|
| 20 |
+
ap=argparse.ArgumentParser(description=__doc__);ap.add_argument('--source',type=Path,required=True);ap.add_argument('--output',type=Path,required=True);a=ap.parse_args();out=a.output;out.mkdir(parents=True,exist_ok=True)
|
| 21 |
+
manifest=json.loads((a.source/'all_files_manifest.json').read_text())
|
| 22 |
+
# Provider checksums were verified on download. Verify local inputs consumed here.
|
| 23 |
+
used=['GSM_validation_points_150_AOI2015_minus_forest.xlsx','GSM_2023_RF_classified_AOI2015_minus_forest.tif','clipping_experiment.xlsx','Irridiance_for_statistics.xlsx']
|
| 24 |
+
for name in used:
|
| 25 |
+
f=next(f for f in manifest['files'] if f['name']==name);raw=(a.source/name).read_bytes();assert hashlib.md5(raw).hexdigest()==f['computed_md5']
|
| 26 |
+
d=pd.read_excel(a.source/used[0]);assert len(d)==150 and d.point_id.is_unique
|
| 27 |
+
assert set(d.correct_01)=={0,1}
|
| 28 |
+
d['reference']=d.ref_class.fillna('').str.upper().str.strip();fill=(d.correct_01==1)&d.reference.eq('');d.loc[fill,'reference']=d.loc[fill,'map_class'];assert d.reference.isin(['PA','LM','HM','OTHER']).all()
|
| 29 |
+
assert (d.reference==d.map_class).eq(d.correct_01.astype(bool)).all()
|
| 30 |
+
counts=pd.crosstab(d.map_class,d.reference).reindex(index=['PA','LM','HM'],columns=['PA','LM','HM','OTHER'],fill_value=0);assert counts.sum(axis=1).eq(50).all();counts.to_csv(out/'reference_confusion_counts.csv')
|
| 31 |
+
with rasterio.open(a.source/used[1]) as r:
|
| 32 |
+
assert r.crs.to_epsg()==26919;image=r.read(1);area=abs(r.transform.a*r.transform.e-r.transform.b*r.transform.d)
|
| 33 |
+
n=np.array([(image==i).sum() for i in [1,2,3]]);areas=n*area;weights=areas/areas.sum()
|
| 34 |
+
codes,totals=np.unique(image,return_counts=True);inventory=pd.DataFrame({'code':codes,'pixels':totals,'area_m2':totals*area});inventory.to_csv(out/'all_raster_class_areas.csv',index=False)
|
| 35 |
+
sampled_domain_fraction=float(n.sum()/(image!=0).sum())
|
| 36 |
+
sampled=np.array([v[0] for v in r.sample(d[['x','y']].to_numpy())]);assert np.array_equal(sampled,d.map_class_id)
|
| 37 |
+
yy,xx=rasterio.transform.rowcol(r.transform,d.x.to_numpy(),d.y.to_numpy());cx,cy=rasterio.transform.xy(r.transform,yy,xx);assert np.max(np.abs(np.array(cx)-d.x))<1e-6 and np.max(np.abs(np.array(cy)-d.y))<1e-6
|
| 38 |
+
profile={'crs':str(r.crs),'width':r.width,'height':r.height,'resolution_m':r.res,'transform':tuple(r.transform),'nodata':r.nodata,'domain':'Only strata 1,2,3 sampled; codes 4-7 unsampled and their class names undocumented in supplied code; 0 nodata. No whole-map inference.'}
|
| 39 |
+
small=r.read(1,out_shape=(700,316),resampling=Resampling.nearest);bounds=r.bounds
|
| 40 |
+
with rasterio.open(a.source/'GSM_20230811.tif') as rgb:
|
| 41 |
+
with WarpedVRT(rgb,crs=r.crs,transform=r.transform,width=r.width,height=r.height,resampling=Resampling.nearest) as v:rgbsmall=v.read([1,2,3],out_shape=(3,700,316),resampling=Resampling.bilinear).transpose(1,2,0)
|
| 42 |
+
probs=counts.to_numpy()/50;adjusted=(areas[:,None]*probs).sum(axis=0);se=np.sqrt((areas[:,None]**2*probs*(1-probs)/49).sum(axis=0))
|
| 43 |
+
result=pd.DataFrame({'class':['PA','LM','HM','OTHER'],'mapped_area_m2':[*areas,np.nan],'adjusted_area_m2':adjusted,'SE_m2':se,'CI95_low_m2':adjusted-1.96*se,'CI95_high_m2':adjusted+1.96*se});result.to_csv(out/'reference_adjusted_area.csv',index=False)
|
| 44 |
+
provider=pd.read_csv(a.source/'GSM_validation_points_150_AOI2015_minus_forest_ADJUSTED_AREA_RESULTS.csv');maxerr=float(np.max(np.abs(provider.adjusted_area_m2-result.adjusted_area_m2)));assert maxerr<1e-6
|
| 45 |
+
assert abs(result.adjusted_area_m2.sum()-areas.sum())<1e-6
|
| 46 |
+
d.to_csv(out/'audited_reference_points.csv',index=False)
|
| 47 |
+
# Parse only labelled original columns, avoiding adjacent duplicated plotting/helper cells.
|
| 48 |
+
sheet=pd.read_excel(a.source/'clipping_experiment.xlsx',sheet_name=0,header=None)
|
| 49 |
+
dates={1:'2023-05-17',3:'2023-06-30',7:'2023-07-18',11:'2023-08-01',15:'2023-08-16',19:'2023-09-09',23:'2023-09-22',27:'2023-10-13',31:'2024-05-14',35:'2024-09-12',39:'2025-07-08'}
|
| 50 |
+
par=pd.read_excel(a.source/'Irridiance_for_statistics.xlsx');ex=par[par.plot_type=='experimental'];assert len(ex)==6;groups=ex.set_index('plot#').treatment_type.to_dict()
|
| 51 |
+
records=[]
|
| 52 |
+
for row in range(4,10):
|
| 53 |
+
plot=int(sheet.iloc[row,0])
|
| 54 |
+
for col,date in dates.items():records.append(dict(plot=plot,treatment=groups[plot],date=date,cover_pct=float(sheet.iloc[row,col]),source_excel_row=row+1,source_excel_column=col+1))
|
| 55 |
+
cover=pd.DataFrame(records);assert cover.cover_pct.between(0,100).all();assert not cover.duplicated(['plot','date']).any();cover.to_csv(out/'clipping_plot_time.csv',index=False)
|
| 56 |
+
means=cover.groupby(['date','treatment']).cover_pct.mean().unstack();means['clipped_minus_control']=means.clipped-means.control;means['difference_in_change_from_first_observation']=means.clipped_minus_control-means.clipped_minus_control.iloc[0];means.to_csv(out/'clipping_descriptive_contrasts.csv')
|
| 57 |
+
for col in dates:
|
| 58 |
+
assert abs(sheet.iloc[14,col]-cover[(cover.date==dates[col])&(cover.treatment=='clipped')].cover_pct.mean())<1e-8
|
| 59 |
+
assert abs(sheet.iloc[15,col]-cover[(cover.date==dates[col])&(cover.treatment=='control')].cover_pct.mean())<1e-8
|
| 60 |
+
par.to_csv(out/'irradiance_plot_means.csv',index=False)
|
| 61 |
+
# Source scripts explicitly use within-polygon random pixels. Missing shapefile
|
| 62 |
+
# sidecars prevent recovery of training class attributes/CRS from that file alone.
|
| 63 |
+
missing_sidecars=[name for name in ['GSM_training_data_2023.dbf','GSM_training_data_2023.shx','GSM_training_data_2023.prj'] if not (a.source/name).exists()]
|
| 64 |
+
audit={'dataset_doi':manifest['doi'],'paper_doi':manifest['paper_doi'],'source_files':len(manifest['files']),'source_bytes':manifest['total_bytes'],'provider_md5_verified_on_download':True,'sampled_domain_fraction_of_nonzero_map':sampled_domain_fraction,'reference_points':len(d),'reference_points_agree_with_raster':int((sampled==d.map_class_id).sum()),'unweighted_reference_agreement':float(d.correct_01.mean()),'area_weighted_reference_agreement':float(np.sum(weights*np.diag(probs[:,:3]))),'published_adjusted_area_max_error_m2':maxerr,'clipping_plots':6,'plots_per_treatment':3,'clipping_plot_dates':len(cover),'last_observed_cover_difference_pp':float(means.clipped_minus_control.iloc[-1]),'first_to_last_difference_in_change_pp':float(means.difference_in_change_from_first_observation.iloc[-1]),'missing_training_sidecars':missing_sidecars,'raster':profile,'limits':['Spartina is native here; Phragmites is the invader. This is not an independent Chinese Spartina invasion replicate.','LM/HM are community classes, not independent species segmentation masks.','Reference points were labelled using the source image, not independent field measurements; uncertainty intervals condition on those labels.','Stratified samples must be weighted by mapped area; classes 4-7 are nonzero but unsampled, so reference agreement cannot assess the whole map.','Three plots per clipping arm with repeated dates; assignment/randomization and pairing are not established from the archived metadata. No causal P value or treatment-effect confidence interval is asserted.','Original RF checkpoint and complete training shapefile components are unavailable; original training accuracy is not independently reproduced.']}
|
| 65 |
+
(out/'audit.json').write_text(json.dumps(audit,indent=2))
|
| 66 |
+
plt.rcParams.update({'font.family':'DejaVu Sans','font.size':7,'axes.titlesize':7,'axes.labelsize':7,'axes.spines.top':False,'axes.spines.right':False,'lines.linewidth':1,'pdf.fonttype':42,'svg.fonttype':'none'})
|
| 67 |
+
fig,axs=plt.subplots(2,2,figsize=(183/25.4,160/25.4),layout='constrained',gridspec_kw={'height_ratios':[1.2,1]})
|
| 68 |
+
extent=[bounds.left,bounds.right,bounds.bottom,bounds.top]
|
| 69 |
+
axs[0,0].imshow(rgbsmall,extent=extent);axs[0,0].scatter(d.x,d.y,c=d.correct_01.map({1:'#009E73',0:'#D55E00'}),s=4,linewidths=.15,edgecolors='white');axs[0,0].set_title('Source imagery and reference agreement',loc='left');axs[0,0].set_axis_off()
|
| 70 |
+
axs[0,0].text(.02,.02,'Green: agrees; orange: disagrees',transform=axs[0,0].transAxes,fontsize=5.5,color='white',bbox=dict(facecolor='black',alpha=.6,pad=2))
|
| 71 |
+
display=small.copy();display[display>3]=4
|
| 72 |
+
axs[0,1].imshow(display,cmap=ListedColormap(['#ffffff','#CC79A7','#009E73','#E69F00','#b6b6b6']),vmin=0,vmax=4,extent=extent);axs[0,1].set_title('Published map and unsampled classes',loc='left');axs[0,1].set_axis_off()
|
| 73 |
+
from matplotlib.patches import Patch
|
| 74 |
+
axs[0,1].legend(handles=[Patch(color=c,label=l) for c,l in [('#CC79A7','PA'),('#009E73','LM'),('#E69F00','HM'),('#b6b6b6','Codes 4–7 (unsampled)')]],loc='lower left',bbox_to_anchor=(1.01,0),frameon=False,fontsize=5.5)
|
| 75 |
+
for ax in axs[0]:
|
| 76 |
+
x0=bounds.left+40;y0=bounds.bottom+180
|
| 77 |
+
ax.plot([x0,x0+200],[y0,y0],color='black',lw=1)
|
| 78 |
+
ax.text(x0+100,y0+25,'200 m',ha='center',fontsize=5.5,bbox=dict(facecolor='white',edgecolor='none',alpha=.8,pad=1))
|
| 79 |
+
ax=axs[1,0];x=np.arange(4);ax.bar(x-.16,result.mapped_area_m2/10000,width=.32,color='#a9bcc9',label='Mapped');ax.bar(x+.16,result.adjusted_area_m2/10000,width=.32,color='#0072B2',label='Reference-adjusted');ax.errorbar(x+.16,result.adjusted_area_m2/10000,yerr=1.96*result.SE_m2/10000,fmt='none',ecolor='#333333',capsize=2,lw=.7);ax.set(xticks=x,xticklabels=result['class'],ylabel='Area within mapped domain (ha)');ax.legend(frameon=False,fontsize=6);ax.set_title('Stratified reference-based area estimates',loc='left')
|
| 80 |
+
ax=axs[1,1]
|
| 81 |
+
for group,color in [('clipped','#009E73'),('control','#D55E00')]:
|
| 82 |
+
sub=cover[cover.treatment==group]
|
| 83 |
+
for _,g in sub.groupby('plot'):ax.plot(pd.to_datetime(g.date),g.cover_pct,color=color,alpha=.35,lw=.6)
|
| 84 |
+
ax.plot(pd.to_datetime(means.index),means[group],color=color,label=group,lw=1)
|
| 85 |
+
ax.set(ylabel='S. alterniflora cover (%)',ylim=(0,105));ax.set_title('Repeated clipping observations: 3 plots/arm',loc='left');ax.legend(frameon=False,fontsize=6);ax.tick_params(axis='x',rotation=30,labelsize=6)
|
| 86 |
+
for letter,ax in zip('abcd',axs.flat):ax.text(-.1,1.04,letter,transform=ax.transAxes,fontweight='bold',fontsize=8)
|
| 87 |
+
for ext in ['png','pdf','svg']:fig.savefig(out/f'gsm_external_evidence.{ext}',dpi=300)
|
| 88 |
+
plt.close(fig);print(json.dumps(audit,indent=2))
|
| 89 |
+
if __name__=='__main__':main()
|
data/derived/china_patch_traits_20261007/audit.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source_doi": "10.3389/fpls.2026.1913369.s001",
|
| 3 |
+
"paper_doi": "10.3389/fpls.2026.1913369",
|
| 4 |
+
"published_sites": 10,
|
| 5 |
+
"site_tidal_cells": 20,
|
| 6 |
+
"window_area_m2": 2500,
|
| 7 |
+
"raw_images_acquired": false,
|
| 8 |
+
"individual_trait_records_acquired": false,
|
| 9 |
+
"nominal_overlapping_sites": [
|
| 10 |
+
"Site10"
|
| 11 |
+
],
|
| 12 |
+
"coordinate_resolution_degrees": 0.01,
|
| 13 |
+
"interpretation": "Site10 nominal coordinates fall within the local aerial footprint. Its September 2025 campaign is later than our 2014\u20132021 imagery. Coordinate rounding does not establish shared plots or image footprints. Treat as a potential temporal extension, not independent spatial validation. Densities use the 50 by 50 m windows documented in Methods. Covered areas inherit rounding of published cover fractions.",
|
| 14 |
+
"raw_data_availability": "Author request; no openly linked raw-data repository identified in full-text availability statement. No authors contacted.",
|
| 15 |
+
"confounding": "Province, campaign season and year are confounded; this table cannot identify latitude effects independently of sampling season/year.",
|
| 16 |
+
"table_scope": "Supplement Table S1 site-level aggregates; no individual trait data or new trait-effect estimation."
|
| 17 |
+
}
|
data/derived/china_patch_traits_20261007/published_site_context.pdf
ADDED
|
Binary file (24.7 kB). View file
|
|
|
data/derived/china_patch_traits_20261007/published_site_context.png
ADDED
|
Git LFS Details
|
data/derived/china_patch_traits_20261007/published_site_context.svg
ADDED
|
|
data/derived/china_patch_traits_20261007/published_sites_and_overlap_screen.csv
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
region,site,longitude,latitude,resolution_m,low_patch_count,low_cover_fraction,high_patch_count,high_cover_fraction,campaign_month,window_area_m2,low_patch_density_per_1000_m2,low_covered_area_m2_approx,high_patch_density_per_1000_m2,high_covered_area_m2_approx,nominal_point_in_local_image,rounded_coordinate_cell_intersects_local_image
|
| 2 |
+
Yancheng,Site1,119.81,34.47,0.028,83,0.02,379,0.08,2025-06,2500,33.2,50.0,151.60000000000002,200.0,False,False
|
| 3 |
+
Yancheng,Site2,120.48,33.85,0.029,70,0.03,307,0.1,2025-06,2500,28.0,75.0,122.80000000000001,250.0,False,False
|
| 4 |
+
Yancheng,Site3,120.92,32.95,0.031,284,0.1,403,0.14,2025-06,2500,113.60000000000001,250.0,161.20000000000002,350.00000000000006,False,False
|
| 5 |
+
Nantong,Site4,120.96,32.62,0.022,21,0.02,39,0.04,2025-06,2500,8.4,50.0,15.6,100.0,False,False
|
| 6 |
+
Nantong,Site5,121.79,31.98,0.029,59,0.05,75,0.18,2025-06,2500,23.599999999999998,125.0,30.0,450.0,False,False
|
| 7 |
+
Ningbo,Site6,121.53,29.2,0.049,19,0.44,18,0.61,2023-10,2500,7.6,1100.0,7.2,1525.0,False,False
|
| 8 |
+
Wenzhou,Site7,120.97,27.89,0.033,57,0.24,97,0.32,2023-10,2500,22.8,600.0,38.800000000000004,800.0,False,False
|
| 9 |
+
Zhangzhou,Site8,117.91,24.48,0.029,82,0.08,237,0.16,2025-09,2500,32.800000000000004,200.0,94.8,400.0,False,False
|
| 10 |
+
Zhangzhou,Site9,117.77,23.98,0.029,52,0.05,54,0.08,2025-09,2500,20.8,125.0,21.6,200.0,False,False
|
| 11 |
+
Zhangzhou,Site10,117.43,23.93,0.028,27,0.13,28,0.15,2025-09,2500,10.8,325.0,11.2,375.0,True,True
|
data/derived/gsm_competition_20261007/all_raster_class_areas.csv
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
code,pixels,area_m2
|
| 2 |
+
0,5006759,450608.31
|
| 3 |
+
1,159084,14317.56
|
| 4 |
+
2,2285281,205675.28999999998
|
| 5 |
+
3,538346,48451.14
|
| 6 |
+
4,2065907,185931.63
|
| 7 |
+
5,433827,39044.43
|
| 8 |
+
6,288556,25970.039999999997
|
| 9 |
+
7,208031,18722.79
|