gomd 2.1.0__py3-none-any.whl
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.
- gomd/__init__.py +380 -0
- gomd/__main__.py +7 -0
- gomd/cli.py +76 -0
- gomd/client.py +1372 -0
- gomd/dynamics.py +629 -0
- gomd/maritime.py +952 -0
- gomd/ocean.py +1646 -0
- gomd/spatial.py +222 -0
- gomd/stats.py +1086 -0
- gomd-2.1.0.dist-info/METADATA +277 -0
- gomd-2.1.0.dist-info/RECORD +15 -0
- gomd-2.1.0.dist-info/WHEEL +5 -0
- gomd-2.1.0.dist-info/entry_points.txt +2 -0
- gomd-2.1.0.dist-info/licenses/LICENSE +21 -0
- gomd-2.1.0.dist-info/top_level.txt +1 -0
gomd/__init__.py
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
"""
|
|
2
|
+
GOMD — Official Python Scientific, Oceanographic, Maritime Decarbonization & Econometric SDK (v2.1.0)
|
|
3
|
+
Global Ocean & Maritime Data Platform (Piri Reis University / COP31 Türkiye)
|
|
4
|
+
https://gomd.pirireis.edu.tr | Documentation: https://gomd.pirireis.edu.tr/python_sdk_docs.php
|
|
5
|
+
|
|
6
|
+
Modules included in gomd v2.1.0:
|
|
7
|
+
1. gomd.client — Authenticated REST/Bulk Client, Multi-Indicator Panel Builder, SHA-256 Provenance & Local Disk Cache
|
|
8
|
+
2. gomd.ocean — Physical & Biogeochemical Oceanography + Post-2020 Frontier Methods:
|
|
9
|
+
EOS-80 Density, TEOS-10 GSW & Sallée (Nature 2021) Stratification, Garcia & Gordon DO Solubility & AOU,
|
|
10
|
+
Marine Carbonate System & Omega_arag, Hobday MHW Detector, Gruber (Science 2021) & Burger (Nature 2022)
|
|
11
|
+
Triple Compound MHW+OAX+LOX Event & Clarke (2021) Aerobic Growth Index (AGI), Carlson TSI & Vollenweider
|
|
12
|
+
TRIX, Mucilage Risk Index, and Bertram (2021) / Rennert (Nature 2022) Blue Carbon SCC Valuation.
|
|
13
|
+
3. gomd.maritime — Maritime Decarbonization, Green Finance & Port State Control + Post-2020 Frontier Regulations:
|
|
14
|
+
IMO CII AER & Rating A-E, Directive (EU) 2023/959 Maritime EU ETS Phase-in, Regulation (EU) 2023/1805
|
|
15
|
+
FuelEU Maritime Well-to-Wake (WtW) GHG Intensity & RFNBO 2x Multiplier, IMO 2023 Revised GHG Strategy
|
|
16
|
+
(MEPC.377(80)) Stranded-Asset & Carbon VaR, Bottom-Up AIS Admiralty-Cube Propulsion & Slow-Steaming
|
|
17
|
+
Elasticity, Poseidon Principles Alignment, and Paris/Med MoU PSC Risk Profile.
|
|
18
|
+
4. gomd.stats — Non-Parametric Environmental, Causal & Panel Econometrics + Post-2020 Frontier Methods:
|
|
19
|
+
Mann-Kendall Trend, Theil-Sen Slope, Pettitt Regime Shift, Gumbel Return Levels, Engle-Granger
|
|
20
|
+
Cointegration, One-Way Fixed Effects Panel Estimator, Arkhangelsky et al. (AER 2021) Synthetic
|
|
21
|
+
Difference-in-Differences (SDID), Şen (2020/2021) Innovative Polygon & Sub-Regime Quantile Trend,
|
|
22
|
+
and Runge et al. (Nature Comms / Nat. Rev. 2023) Information-Theoretic Shannon Transfer Entropy.
|
|
23
|
+
5. gomd.spatial — Geodesic & Chokepoint Spatial Analytics (Haversine Distance & Bearing, IHO Sea-Basin Classifier,
|
|
24
|
+
Global 10-Chokepoint Proximity Matrix, OGC CRS84 GeoJSON Exporter)
|
|
25
|
+
6. gomd.cli — Command-Line Interface (`python -m gomd cite | cii | carbonate | basin`)
|
|
26
|
+
7. gomd.dynamics — Port, Fisheries & Climate Dynamics Toolkit (new in 2.1.0; methods used in the GOMD research papers):
|
|
27
|
+
Symmetric (DHS) Growth, Static Principal-Component Global Factor & Variance Shares, Index of Dispersion,
|
|
28
|
+
Cargo Bunching & Compound-Poisson Benchmark, Day-of-Week Profile, Gibrat's-Law & Volatility-Size Scaling,
|
|
29
|
+
Portfolio Effect & Synchrony, Exceedance Return Interval, Benjamini-Hochberg FDR, Binomial Field
|
|
30
|
+
Significance, and Event-Study Local Projections with Unit & Time Fixed Effects.
|
|
31
|
+
|
|
32
|
+
Please cite GOMD in any academic publication, thesis, or policy report using this package:
|
|
33
|
+
>>> import gomd
|
|
34
|
+
>>> print(gomd.cite())
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
from __future__ import annotations
|
|
38
|
+
|
|
39
|
+
from . import cli, client, dynamics, maritime, ocean, spatial, stats
|
|
40
|
+
from .client import (
|
|
41
|
+
CITATION_APA,
|
|
42
|
+
CITATION_BIBTEX,
|
|
43
|
+
CITATION_IEEE,
|
|
44
|
+
CITATION_TR,
|
|
45
|
+
GOMDClient,
|
|
46
|
+
GOMDError,
|
|
47
|
+
cite,
|
|
48
|
+
)
|
|
49
|
+
from .maritime import (
|
|
50
|
+
FUELEU_WTW_PROFILES,
|
|
51
|
+
ais_speed_power_emissions,
|
|
52
|
+
arctic_route_navigability_index,
|
|
53
|
+
calculate_eu_ets_exposure,
|
|
54
|
+
calculate_fueleu_maritime,
|
|
55
|
+
calculate_imo_cii,
|
|
56
|
+
desalination_brine_green_h2_nexus,
|
|
57
|
+
fueleu_cii_ets_compliance_cost,
|
|
58
|
+
global_chokepoint_disruption_index,
|
|
59
|
+
imo_2023_strive_trajectory,
|
|
60
|
+
kunming_montreal_30x30_gap,
|
|
61
|
+
marine_insurance_actuarial_pricing,
|
|
62
|
+
poseidon_principles_alignment,
|
|
63
|
+
psc_detention_risk_score,
|
|
64
|
+
rfmo_stock_iuu_sustainability,
|
|
65
|
+
seaborne_trade_climate_coupling_index,
|
|
66
|
+
subsea_corridor_vulnerability_index,
|
|
67
|
+
)
|
|
68
|
+
from .ocean import (
|
|
69
|
+
blue_carbon_sequestration_valuation,
|
|
70
|
+
carbonate_system,
|
|
71
|
+
climate_teleconnection_regime,
|
|
72
|
+
coastal_storm_surge_offshore_wind_nexus,
|
|
73
|
+
compound_mhw_oax_event,
|
|
74
|
+
coral_bleaching_dhw_risk,
|
|
75
|
+
cwon_wealth_accounting,
|
|
76
|
+
ectotherm_thermal_shock_index,
|
|
77
|
+
global_hypoxia_deadzone_index,
|
|
78
|
+
lme_trophic_hypoxia_stress,
|
|
79
|
+
marine_heatwave_detect,
|
|
80
|
+
marine_plastic_ghost_gear_risk,
|
|
81
|
+
mucilage_risk_index,
|
|
82
|
+
ocean_climate_velocity,
|
|
83
|
+
offshore_wind_marine_energy_lcoe,
|
|
84
|
+
oxygen_solubility,
|
|
85
|
+
polar_cryosphere_basal_melt_albedo,
|
|
86
|
+
river_delta_plastic_nutrient_export,
|
|
87
|
+
seawater_density_eos80,
|
|
88
|
+
sids_slr_cyclone_vulnerability,
|
|
89
|
+
sst_warming_velocity_profile,
|
|
90
|
+
stochastic_sst_memory_ou,
|
|
91
|
+
sustainable_insurance_cat_var,
|
|
92
|
+
teos10_gsw_stratification,
|
|
93
|
+
trophic_state_index,
|
|
94
|
+
)
|
|
95
|
+
from .spatial import (
|
|
96
|
+
GLOBAL_CHOKEPOINTS,
|
|
97
|
+
chokepoint_proximity,
|
|
98
|
+
classify_sea_basin,
|
|
99
|
+
haversine_distance,
|
|
100
|
+
mavi_vatan_eez_audit,
|
|
101
|
+
to_geojson,
|
|
102
|
+
)
|
|
103
|
+
from .dynamics import (
|
|
104
|
+
cargo_bunching,
|
|
105
|
+
common_factor_decomposition,
|
|
106
|
+
dispersion_index,
|
|
107
|
+
exceedance_return_interval,
|
|
108
|
+
fdr_benjamini_hochberg,
|
|
109
|
+
field_significance,
|
|
110
|
+
local_projection_event,
|
|
111
|
+
portfolio_effect,
|
|
112
|
+
size_growth_scaling,
|
|
113
|
+
symmetric_growth,
|
|
114
|
+
weekday_profile,
|
|
115
|
+
)
|
|
116
|
+
from .stats import (
|
|
117
|
+
audit_numeric_grounding,
|
|
118
|
+
cointegration_eg_test,
|
|
119
|
+
counter_r5_usage_econometrics,
|
|
120
|
+
extreme_return_levels,
|
|
121
|
+
innovative_polygon_trend,
|
|
122
|
+
mann_kendall_sen,
|
|
123
|
+
multivariate_data_mining_pipeline,
|
|
124
|
+
panel_fixed_effects,
|
|
125
|
+
pettitt_changepoint,
|
|
126
|
+
synthetic_did_ate,
|
|
127
|
+
transfer_entropy_causal,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
_default_client: GOMDClient | None = None
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def _client() -> GOMDClient:
|
|
134
|
+
global _default_client
|
|
135
|
+
if _default_client is None:
|
|
136
|
+
_default_client = GOMDClient()
|
|
137
|
+
return _default_client
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def get_public_catalog():
|
|
141
|
+
return _client().get_public_catalog()
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def get_public_sources(as_df: bool = True):
|
|
145
|
+
return _client().get_public_sources(as_df=as_df)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def search_indicators(keyword: str = "", category: str | None = None, source_key: str | None = None, as_df: bool = True):
|
|
149
|
+
return _client().search_indicators(keyword=keyword, category=category, source_key=source_key, as_df=as_df)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def get_indicator_detail(indicator: str = "gml_mauna_loa_co2_ppm", dataset: str = "open"):
|
|
153
|
+
return _client().get_indicator_detail(indicator=indicator, dataset=dataset)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def get_series(indicator: str = "gml_mauna_loa_co2_ppm", entity="WLD", period_from=None, period_to=None, limit: int = 5000, as_df: bool = True):
|
|
157
|
+
return _client().get_series(indicator=indicator, entity=entity, period_from=period_from, period_to=period_to, limit=limit, as_df=as_df)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def get_blue_finance_atlas(
|
|
161
|
+
indicator: str = "iumi_marine_insurance_total_premium_usd_mn",
|
|
162
|
+
entities=("WLD", "EU27", "CHN", "USA", "NOR", "TUR"),
|
|
163
|
+
period_from: int = 1995,
|
|
164
|
+
period_to: int = 2025,
|
|
165
|
+
as_df: bool = True,
|
|
166
|
+
):
|
|
167
|
+
return _client().get_blue_finance_atlas(
|
|
168
|
+
indicator=indicator,
|
|
169
|
+
entities=entities,
|
|
170
|
+
period_from=period_from,
|
|
171
|
+
period_to=period_to,
|
|
172
|
+
as_df=as_df,
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def get_mavi_vatan_jurisdiction(
|
|
177
|
+
indicator: str = "mavi_vatan_official_jurisdiction_km2",
|
|
178
|
+
entities=("TUR", "TRNC", "LBY", "EGY", "BGR", "ROU", "RUS", "UKR", "GEO", "GRC", "CYP"),
|
|
179
|
+
period_from: int = 1986,
|
|
180
|
+
period_to: int = 2026,
|
|
181
|
+
as_df: bool = True,
|
|
182
|
+
):
|
|
183
|
+
return _client().get_mavi_vatan_jurisdiction(
|
|
184
|
+
indicator=indicator,
|
|
185
|
+
entities=entities,
|
|
186
|
+
period_from=period_from,
|
|
187
|
+
period_to=period_to,
|
|
188
|
+
as_df=as_df,
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def get_platform_telemetry_panel(
|
|
193
|
+
indicator: str = "counter_r51_scientific_portal_investigations",
|
|
194
|
+
entities=("TUR", "EU27", "USA", "GBR", "DEU", "WLD"),
|
|
195
|
+
period_from: int = 2018,
|
|
196
|
+
period_to: int = 2026,
|
|
197
|
+
as_df: bool = True,
|
|
198
|
+
):
|
|
199
|
+
"""Deprecated / bilgi amaçlı.
|
|
200
|
+
|
|
201
|
+
COUNTER R5.1 platform telemetri serileri GOMD veritabanında yayımlanmamaktadır
|
|
202
|
+
(canlı veritabanında 0 gözlem). Bu fonksiyon geriye dönük uyumluluk için korunur
|
|
203
|
+
ve genellikle boş sonuç döndürür. Platform kullanım istatistikleri için yöneticiler
|
|
204
|
+
``platform_analytics.php`` panelini kullanmalıdır.
|
|
205
|
+
"""
|
|
206
|
+
return _client().get_platform_telemetry_panel(
|
|
207
|
+
indicator=indicator,
|
|
208
|
+
entities=entities,
|
|
209
|
+
period_from=period_from,
|
|
210
|
+
period_to=period_to,
|
|
211
|
+
as_df=as_df,
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def analyze_gomd_series(indicator: str = "gml_mauna_loa_co2_ppm", entity: str = "WLD", period_from=None, period_to=None):
|
|
216
|
+
return _client().analyze_gomd_series(indicator=indicator, entity=entity, period_from=period_from, period_to=period_to)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def analyze_gomd_basin(basin_code: str = "OCN_MED_LEVANTINE", salinity_psu=38.6, ph_total=8.06, total_alkalinity_umol_kg: float = 2610.0):
|
|
220
|
+
return _client().analyze_gomd_basin(basin_code=basin_code, salinity_psu=salinity_psu, ph_total=ph_total, total_alkalinity_umol_kg=total_alkalinity_umol_kg)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def analyze_gomd_policy(indicator: str = "worldbank_primary_index_v2026", treated_entity: str = "TUR", control_entities=("DEU", "FRA", "ITA", "ESP", "GRC"), intervention_year: int = 2022, period_from: int = 2015, period_to: int = 2025):
|
|
224
|
+
return _client().analyze_gomd_policy(indicator=indicator, treated_entity=treated_entity, control_entities=control_entities, intervention_year=intervention_year, period_from=period_from, period_to=period_to)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def build_panel(indicators=None, entities=None, period_from=1990, period_to=2025, dataset: str = "open_data_observations", limit_per_indicator: int = 10000, as_df: bool = True, indicator_keys=None, as_dataframe: bool | None = None):
|
|
228
|
+
if as_dataframe is not None:
|
|
229
|
+
as_df = bool(as_dataframe)
|
|
230
|
+
return _client().build_panel(indicators=indicators, entities=entities, period_from=period_from, period_to=period_to, dataset=dataset, limit_per_indicator=limit_per_indicator, as_df=as_df, indicator_keys=indicator_keys, as_dataframe=as_dataframe)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def query(dataset: str = "open_data_observations", filters=None, search=None, period_from=None, period_to=None, order_by=None, order_dir: str = "DESC", limit: int = 1000, offset: int = 0, as_df: bool = True):
|
|
234
|
+
return _client().query(dataset=dataset, filters=filters, search=search, period_from=period_from, period_to=period_to, order_by=order_by, order_dir=order_dir, limit=limit, offset=offset, as_df=as_df)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def timeseries(dataset: str = "open_data_observations", value_column: str = "value", filters=None, period_from=None, period_to=None, as_df: bool = True):
|
|
238
|
+
return _client().timeseries(dataset=dataset, value_column=value_column, filters=filters, period_from=period_from, period_to=period_to, as_df=as_df)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def bulk_export(dataset: str = "open_data_observations", fmt: str = "csv", limit: int = 50000, period_from=None, period_to=None, as_df: bool = True):
|
|
242
|
+
return _client().bulk_export(dataset=dataset, fmt=fmt, limit=limit, period_from=period_from, period_to=period_to, as_df=as_df)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def verify_provenance(payload, expected_sha256=None):
|
|
246
|
+
return GOMDClient.verify_provenance(payload=payload, expected_sha256=expected_sha256)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def ask_assistant(question: str, lang: str = "tr", history=None):
|
|
250
|
+
"""GOMD Veri Asistanı'na (RAG + araç çağırma) kaynak atıflı soru sorar."""
|
|
251
|
+
return _client().ask_assistant(question=question, lang=lang, history=history)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def assistant_status():
|
|
255
|
+
"""Veri Asistanı durumunu ve kalan günlük kotayı döndürür."""
|
|
256
|
+
return _client().assistant_status()
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
__version__ = "2.1.0"
|
|
260
|
+
__paper_url__ = "https://gomd.pirireis.edu.tr/sdk_paper.php"
|
|
261
|
+
__citation__ = CITATION_APA
|
|
262
|
+
__bibtex__ = CITATION_BIBTEX
|
|
263
|
+
|
|
264
|
+
__all__ = [
|
|
265
|
+
# Core Client & Citations
|
|
266
|
+
"GOMDClient",
|
|
267
|
+
"GOMDError",
|
|
268
|
+
"cite",
|
|
269
|
+
"CITATION_APA",
|
|
270
|
+
"CITATION_IEEE",
|
|
271
|
+
"CITATION_TR",
|
|
272
|
+
"CITATION_BIBTEX",
|
|
273
|
+
"get_public_catalog",
|
|
274
|
+
"get_public_sources",
|
|
275
|
+
"search_indicators",
|
|
276
|
+
"get_indicator_detail",
|
|
277
|
+
"get_series",
|
|
278
|
+
"get_blue_finance_atlas",
|
|
279
|
+
"get_mavi_vatan_jurisdiction",
|
|
280
|
+
"get_platform_telemetry_panel",
|
|
281
|
+
"analyze_gomd_series",
|
|
282
|
+
"analyze_gomd_basin",
|
|
283
|
+
"analyze_gomd_policy",
|
|
284
|
+
"build_panel",
|
|
285
|
+
"query",
|
|
286
|
+
"timeseries",
|
|
287
|
+
"bulk_export",
|
|
288
|
+
"verify_provenance",
|
|
289
|
+
"ask_assistant",
|
|
290
|
+
"assistant_status",
|
|
291
|
+
# Submodules
|
|
292
|
+
"client",
|
|
293
|
+
"ocean",
|
|
294
|
+
"maritime",
|
|
295
|
+
"stats",
|
|
296
|
+
"dynamics",
|
|
297
|
+
"spatial",
|
|
298
|
+
"cli",
|
|
299
|
+
# Oceanography, Blue Carbon & Parametric Sustainability Insurance (gomd.ocean)
|
|
300
|
+
"seawater_density_eos80",
|
|
301
|
+
"teos10_gsw_stratification",
|
|
302
|
+
"oxygen_solubility",
|
|
303
|
+
"carbonate_system",
|
|
304
|
+
"marine_heatwave_detect",
|
|
305
|
+
"compound_mhw_oax_event",
|
|
306
|
+
"trophic_state_index",
|
|
307
|
+
"mucilage_risk_index",
|
|
308
|
+
"blue_carbon_sequestration_valuation",
|
|
309
|
+
"sustainable_insurance_cat_var",
|
|
310
|
+
"cwon_wealth_accounting",
|
|
311
|
+
"sst_warming_velocity_profile",
|
|
312
|
+
"ocean_climate_velocity",
|
|
313
|
+
"ectotherm_thermal_shock_index",
|
|
314
|
+
"stochastic_sst_memory_ou",
|
|
315
|
+
"global_hypoxia_deadzone_index",
|
|
316
|
+
"offshore_wind_marine_energy_lcoe",
|
|
317
|
+
"marine_plastic_ghost_gear_risk",
|
|
318
|
+
"coastal_storm_surge_offshore_wind_nexus",
|
|
319
|
+
"climate_teleconnection_regime",
|
|
320
|
+
"coral_bleaching_dhw_risk",
|
|
321
|
+
"lme_trophic_hypoxia_stress",
|
|
322
|
+
"river_delta_plastic_nutrient_export",
|
|
323
|
+
"sids_slr_cyclone_vulnerability",
|
|
324
|
+
"polar_cryosphere_basal_melt_albedo",
|
|
325
|
+
# Maritime, Decarbonization & Marine Insurance Underwriting (gomd.maritime)
|
|
326
|
+
"FUELEU_WTW_PROFILES",
|
|
327
|
+
"calculate_imo_cii",
|
|
328
|
+
"calculate_eu_ets_exposure",
|
|
329
|
+
"calculate_fueleu_maritime",
|
|
330
|
+
"imo_2023_strive_trajectory",
|
|
331
|
+
"ais_speed_power_emissions",
|
|
332
|
+
"poseidon_principles_alignment",
|
|
333
|
+
"psc_detention_risk_score",
|
|
334
|
+
"marine_insurance_actuarial_pricing",
|
|
335
|
+
"global_chokepoint_disruption_index",
|
|
336
|
+
"kunming_montreal_30x30_gap",
|
|
337
|
+
"arctic_route_navigability_index",
|
|
338
|
+
"seaborne_trade_climate_coupling_index",
|
|
339
|
+
"fueleu_cii_ets_compliance_cost",
|
|
340
|
+
"subsea_corridor_vulnerability_index",
|
|
341
|
+
"rfmo_stock_iuu_sustainability",
|
|
342
|
+
"desalination_brine_green_h2_nexus",
|
|
343
|
+
# Econometrics, Causal Inference & Climate Statistics (gomd.stats)
|
|
344
|
+
"mann_kendall_sen",
|
|
345
|
+
"pettitt_changepoint",
|
|
346
|
+
"extreme_return_levels",
|
|
347
|
+
"cointegration_eg_test",
|
|
348
|
+
"panel_fixed_effects",
|
|
349
|
+
"synthetic_did_ate",
|
|
350
|
+
"innovative_polygon_trend",
|
|
351
|
+
"transfer_entropy_causal",
|
|
352
|
+
"multivariate_data_mining_pipeline",
|
|
353
|
+
"counter_r5_usage_econometrics",
|
|
354
|
+
"audit_numeric_grounding",
|
|
355
|
+
# Spatial & Chokepoints (gomd.spatial)
|
|
356
|
+
"GLOBAL_CHOKEPOINTS",
|
|
357
|
+
"haversine_distance",
|
|
358
|
+
"classify_sea_basin",
|
|
359
|
+
"chokepoint_proximity",
|
|
360
|
+
"mavi_vatan_eez_audit",
|
|
361
|
+
"to_geojson",
|
|
362
|
+
# Metadata
|
|
363
|
+
# Port, Fisheries & Climate Dynamics (gomd.dynamics, new in 2.1.0)
|
|
364
|
+
"cargo_bunching",
|
|
365
|
+
"common_factor_decomposition",
|
|
366
|
+
"dispersion_index",
|
|
367
|
+
"exceedance_return_interval",
|
|
368
|
+
"fdr_benjamini_hochberg",
|
|
369
|
+
"field_significance",
|
|
370
|
+
"local_projection_event",
|
|
371
|
+
"portfolio_effect",
|
|
372
|
+
"size_growth_scaling",
|
|
373
|
+
"symmetric_growth",
|
|
374
|
+
"weekday_profile",
|
|
375
|
+
"__version__",
|
|
376
|
+
"__paper_url__",
|
|
377
|
+
"__citation__",
|
|
378
|
+
"__bibtex__",
|
|
379
|
+
]
|
|
380
|
+
|
gomd/__main__.py
ADDED
gomd/cli.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""
|
|
2
|
+
gomd.cli — Command-Line Interface for the GOMD Python SDK
|
|
3
|
+
Usage:
|
|
4
|
+
python -m gomd cite [apa|tr|ieee|bibtex]
|
|
5
|
+
python -m gomd cii --fuel 4200 --dwt 82000 --nm 58000 --type bulk_carrier
|
|
6
|
+
python -m gomd carbonate --ph 8.06 --temp 18.5 --salinity 38.2
|
|
7
|
+
python -m gomd basin --lat 40.98 --lon 28.95
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import argparse
|
|
13
|
+
import json
|
|
14
|
+
import sys
|
|
15
|
+
from typing import List, Optional
|
|
16
|
+
|
|
17
|
+
from .client import GOMDClient, cite
|
|
18
|
+
from .maritime import calculate_imo_cii
|
|
19
|
+
from .ocean import carbonate_system, seawater_density_eos80
|
|
20
|
+
from .spatial import chokepoint_proximity
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def main(argv: Optional[List[str]] = None) -> int:
|
|
24
|
+
parser = argparse.ArgumentParser(
|
|
25
|
+
prog="gomd",
|
|
26
|
+
description="GOMD Official Scientific & Maritime Analytics CLI (https://gomd.pirireis.edu.tr)",
|
|
27
|
+
)
|
|
28
|
+
sub = parser.add_subparsers(dest="command")
|
|
29
|
+
|
|
30
|
+
# 1. cite
|
|
31
|
+
p_cite = sub.add_parser("cite", help="Print official academic citation for GOMD")
|
|
32
|
+
p_cite.add_argument("style", nargs="?", default="all", choices=["all", "apa", "tr", "ieee", "bibtex"])
|
|
33
|
+
|
|
34
|
+
# 2. cii
|
|
35
|
+
p_cii = sub.add_parser("cii", help="Calculate IMO CII AER, Required CII & A-E Rating")
|
|
36
|
+
p_cii.add_argument("--fuel", type=float, required=True, help="Fuel consumption in metric tonnes")
|
|
37
|
+
p_cii.add_argument("--dwt", type=float, required=True, help="Deadweight tonnage (DWT)")
|
|
38
|
+
p_cii.add_argument("--nm", type=float, required=True, help="Distance sailed in nautical miles")
|
|
39
|
+
p_cii.add_argument("--type", default="bulk_carrier", help="Vessel type")
|
|
40
|
+
p_cii.add_argument("--fuel-type", default="vlsfo", help="Fuel type (vlsfo, hfo, mdo, lng, methanol)")
|
|
41
|
+
p_cii.add_argument("--year", type=int, default=2026, help="Reporting year")
|
|
42
|
+
|
|
43
|
+
# 3. carbonate
|
|
44
|
+
p_carb = sub.add_parser("carbonate", help="Solve surface ocean carbonate chemistry & Omega_arag")
|
|
45
|
+
p_carb.add_argument("--ph", type=float, required=True, help="Total-scale pH")
|
|
46
|
+
p_carb.add_argument("--temp", type=float, required=True, help="Sea surface temperature (C)")
|
|
47
|
+
p_carb.add_argument("--salinity", type=float, default=35.0, help="Salinity (PSU)")
|
|
48
|
+
p_carb.add_argument("--ta", type=float, default=2320.0, help="Total alkalinity (umol/kg)")
|
|
49
|
+
|
|
50
|
+
# 4. basin
|
|
51
|
+
p_basin = sub.add_parser("basin", help="Classify sea basin and compute chokepoint distances")
|
|
52
|
+
p_basin.add_argument("--lat", type=float, required=True, help="Latitude")
|
|
53
|
+
p_basin.add_argument("--lon", type=float, required=True, help="Longitude")
|
|
54
|
+
|
|
55
|
+
args = parser.parse_args(argv)
|
|
56
|
+
if args.command in (None, "cite"):
|
|
57
|
+
style = getattr(args, "style", "all")
|
|
58
|
+
print(cite(style))
|
|
59
|
+
return 0
|
|
60
|
+
if args.command == "cii":
|
|
61
|
+
res = calculate_imo_cii(args.fuel, args.dwt, args.nm, args.type, args.fuel_type, args.year)
|
|
62
|
+
print(json.dumps(res, indent=2))
|
|
63
|
+
return 0
|
|
64
|
+
if args.command == "carbonate":
|
|
65
|
+
res = carbonate_system(args.ph, args.temp, args.salinity, args.ta)
|
|
66
|
+
print(json.dumps(res, indent=2))
|
|
67
|
+
return 0
|
|
68
|
+
if args.command == "basin":
|
|
69
|
+
res = chokepoint_proximity(args.lat, args.lon)
|
|
70
|
+
print(json.dumps(res, indent=2))
|
|
71
|
+
return 0
|
|
72
|
+
return 0
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
sys.exit(main())
|