From 0a2dd4ac3c9f1c085bfaf1c0329092ecbffcec19 Mon Sep 17 00:00:00 2001 From: Antoine Anceau <252369389+antoineanceau@users.noreply.github.com> Date: Wed, 22 Apr 2026 22:23:44 +0200 Subject: [PATCH] docs: add csv import to readmes --- README.md | 4 ++++ python/README.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 62160f3..bc1f36a 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,10 @@ from navaltoolbox import LoadingCondition, MassCategory lc = LoadingCondition("Departure") lc.add_mass_simple("Lightship", 5000000.0, (40.0, 0.0, 5.0), MassCategory.lightship()) +# You can also import loading conditions from JSON or a unified CSV format: +# lc = LoadingCondition.from_csv('Type,Name,Mass,LCG,TCG,VCG,Category,FillPercent\nMass,Cargo,1000,10,0,5,Deadweight,\nTank,FO_1P,,,,,,95.0') +# lc = LoadingCondition.load_csv("my_loading_condition.csv") + # Calculate GZ curve directly from LoadingCondition stab = StabilityCalculator(vessel, water_density=1025.0) heels = [0, 10, 20, 30, 40, 50, 60] diff --git a/python/README.md b/python/README.md index 2863414..f0ac86b 100644 --- a/python/README.md +++ b/python/README.md @@ -127,6 +127,10 @@ lc = LoadingCondition("Arrival") lc.add_mass_simple("Lightship", 5000000.0, (40.0, 0.0, 5.0), MassCategory.lightship()) lc.set_tank_fill_percent("FO_1", 50.0) +# Import/Export (JSON or CSV) +# lc.save_json("arrival.json") +# lc2 = LoadingCondition.load_csv("departure.csv") + # Use convenience methods directly to seamlessly merge the solid masses and tank configurations: from navaltoolbox import StabilityCalculator, HydrostaticsCalculator