Input¶
Input-data readers: NetCDF time-series forcing files and interpolation utilities used to drive the model from observed or reanalysis data.
Input handling modules.
Observation input — translation of input.F90.
Reads time-series and profile observations from text files and interpolates them linearly to the current simulation time. Two input modes are supported:
method_constant(0) — constant value supplied at configuration time.method_file(2) — ASCII text file with one or more time-stamped records; values are linearly interpolated between bracketing records.
The Fortran constant method_unsupported = huge(1) is mapped to
method_unsupported = math.inf.
Fortran types are mapped to Python classes:
type_input→InputBasetype_scalar_input→ScalarInputtype_profile_input→ProfileInputtype_scalar_input_list→list[ScalarInput](viaInputManager)
Public interface: init_input(), do_input(), close_input(),
register_input(), register_scalar_input(),
register_profile_input(), read_obs(), read_profiles(),
InputManager, ScalarInput, ProfileInput.
Original FORTRAN authors: Jorn Bruggeman.
- class pygotm.input.input.InputManager(nlev=None, scalar_inputs=<factory>, profile_inputs=<factory>, _profile_files=<factory>, _timeseries_files=<factory>)[source]¶
Bases:
objectStateful translation of the GOTM
inputmodule.- Parameters:
nlev (int | None)
scalar_inputs (list[ScalarInput])
profile_inputs (list[ProfileInput])
-
scalar_inputs:
list[ScalarInput]¶
-
profile_inputs:
list[ProfileInput]¶
- register_profile_input(input_)[source]¶
- Return type:
- Parameters:
input_ (ProfileInput)
- register_scalar_input(input_)[source]¶
- Return type:
- Parameters:
input_ (ScalarInput)
- class pygotm.input.input.ProfileInput(name='', method=0, scale_factor=1.0, path='', index=1, add_offset=0.0, constant_value=0.0, minimum=-inf, maximum=inf, method_off=inf, method_constant=0, method_file=2, data=None)[source]¶
Bases:
InputBase- Parameters:
- class pygotm.input.input.ScalarInput(name='', method=0, scale_factor=1.0, path='', index=1, add_offset=0.0, constant_value=0.0, minimum=-inf, maximum=inf, method_off=inf, method_constant=0, method_file=2, value=0.0)[source]¶
Bases:
InputBase- Parameters:
- pygotm.input.input.read_obs(stream, n, *, line_number=0)[source]¶
Read a non-profile observation row from stream.
- pygotm.input.input.read_profiles(stream, nlev, cols, z, *, line_number=0)[source]¶
Read and vertically interpolate a profile block from stream.
- pygotm.input.input.register_input(input_)[source]¶
- Return type:
- Parameters:
input_ (ScalarInput | ProfileInput)
- pygotm.input.input.register_profile_input(input_)[source]¶
- Return type:
- Parameters:
input_ (ProfileInput)
- pygotm.input.input.register_scalar_input(input_)[source]¶
- Return type:
- Parameters:
input_ (ScalarInput)
NetCDF restart input — translation of input_netcdf.F90.
Opens, validates, and reads GOTM restart (NetCDF) files. Verifies that the restart file’s time metadata matches the requested simulation start time, then reads scalar or 1-D profile variables into NumPy arrays.
Depends on pygotm.util.time for read_time_string()
and write_time_string() (Fortran:
use time, only: read_time_string, write_time_string).
Public interface: open_restart(), close_restart(),
check_restart_time(), read_restart_data().
Original FORTRAN authors: Karsten Bolding, Jorn Bruggeman.
- pygotm.input.input_netcdf.check_restart_time(var_name, *, expected_julian, expected_seconds)[source]¶
Verify that the restart file time metadata matches the requested start.
- pygotm.input.input_netcdf.close_restart()[source]¶
Close the active restart NetCDF file.
- Return type: