freegsnke.imas_read_write module
Enables FreeGSNKE-simulated equilibrium data to be read/written to/from IMAS IDS (via the IMAS-Python package), including netCDF serialisation.
Copyright 2025 UKAEA, UKRI-STFC, and The Authors, as per the COPYRIGHT and README files.
This file is part of FreeGSNKE.
FreeGSNKE is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
FreeGSNKE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with FreeGSNKE. If not, see <http://www.gnu.org/licenses/>.
- freegsnke.imas_read_write.load_equilibrium_ids(path: str) object[source]
Reads an equilibrium IDS back from a netCDF file.
- Parameters:
path (str) – Path to a netCDF file previously written by save_equilibrium_ids.
- Returns:
ids – The equilibrium IDS loaded from file.
- Return type:
imas.ids_toplevel.IDSToplevel
- freegsnke.imas_read_write.save_equilibrium_ids(ids: object, path: str) None[source]
Write an equilibrium IDS to a netCDF file.
- Parameters:
ids (imas.ids_toplevel.IDSToplevel) – The equilibrium IDS to save (e.g. as returned by write_equilibrium_to_ids).
path (str) – Destination netCDF file path (should end in .nc).
- freegsnke.imas_read_write.write_equilibrium_to_ids(eq: object, profiles: object) object[source]
Populates an IMAS equilibrium IDS (single time slice) with quantities taken from a solved FreeGSNKE equilibrium.
- Parameters:
eq (freegsnke.equilibrium_update.Equilibrium) – Solved equilibrium object.
profiles (freegsnke.jtor_update profile object) – The profile object used to solve for eq (e.g. a ConstrainPaxisIp or GeneralPprimeFFprime instance).
- Returns:
ids_out – The populated equilibrium IDS.
- Return type:
imas.ids_toplevel.IDSToplevel