pymt package¶
Subpackages¶
- pymt.bmi package
- Submodules
- pymt.bmi.bmi module
BMI
BMI.finalize()
BMI.get_current_time()
BMI.get_end_time()
BMI.get_grid_connectivity()
BMI.get_grid_offset()
BMI.get_grid_rank()
BMI.get_grid_shape()
BMI.get_grid_spacing()
BMI.get_grid_x()
BMI.get_grid_y()
BMI.get_grid_z()
BMI.get_input_var_names()
BMI.get_output_var_names()
BMI.get_start_time()
BMI.get_time_step()
BMI.get_var_grid()
BMI.get_var_type()
BMI.get_var_units()
BMI.initialize()
BMI.run()
Error
VarNameError
- Module contents
- pymt.cmd package
- pymt.component package
- Submodules
- pymt.component.component module
Component
Component.connect()
Component.current_time
Component.end_time
Component.finalize()
Component.from_dict()
Component.from_path()
Component.from_string()
Component.go()
Component.initialize()
Component.load()
Component.load_all()
Component.provides
Component.register()
Component.run()
Component.start_time
Component.time_step
Component.uses
clip_stop_time()
- pymt.component.grid module
- pymt.component.model module
- Module contents
- pymt.events package
- pymt.framework package
- Submodules
- pymt.framework.bmi_bridge module
BmiCap
DataValues
DeprecatedMethods
DeprecatedMethods.get_grid_dim()
DeprecatedMethods.get_grid_face_node_connectivity()
DeprecatedMethods.get_grid_face_node_offset()
DeprecatedMethods.get_grid_face_nodes()
DeprecatedMethods.get_grid_ndim()
DeprecatedMethods.get_grid_nodes_per_face()
DeprecatedMethods.get_grid_number_of_edges()
DeprecatedMethods.get_grid_number_of_faces()
DeprecatedMethods.get_grid_number_of_nodes()
DeprecatedMethods.get_grid_number_of_vertices()
DeprecatedMethods.get_grid_origin()
DeprecatedMethods.get_grid_rank()
DeprecatedMethods.get_grid_shape()
DeprecatedMethods.get_grid_size()
DeprecatedMethods.get_grid_spacing()
DeprecatedMethods.get_grid_type()
DeprecatedMethods.get_grid_x()
DeprecatedMethods.get_grid_y()
DeprecatedMethods.get_grid_z()
DeprecatedMethods.get_var_grid()
DeprecatedMethods.get_var_grid_loc()
DeprecatedMethods.get_var_intent()
DeprecatedMethods.get_var_itemsize()
DeprecatedMethods.get_var_location()
DeprecatedMethods.get_var_nbytes()
DeprecatedMethods.get_var_type()
DeprecatedMethods.get_var_units()
bmi_factory()
- pymt.framework.bmi_docstring module
- pymt.framework.bmi_mapper module
- pymt.framework.bmi_plot module
- pymt.framework.bmi_setup module
- pymt.framework.bmi_timeinterp module
- pymt.framework.bmi_ugrid module
- pymt.framework.services module
- pymt.framework.timeinterp module
- Module contents
- pymt.grids package
- Submodules
- pymt.grids.assertions module
- pymt.grids.connectivity module
- pymt.grids.esmp module
- pymt.grids.field module
- pymt.grids.grid_type module
- pymt.grids.igrid module
- pymt.grids.map module
- pymt.grids.meshgrid module
- pymt.grids.raster module
- pymt.grids.rectilinear module
- pymt.grids.structured module
- pymt.grids.unstructured module
Unstructured
UnstructuredPoints
UnstructuredPoints.__init__()
UnstructuredPoints.get_attrs()
UnstructuredPoints.get_axis_coordinates()
UnstructuredPoints.get_cell_count()
UnstructuredPoints.get_connectivity()
UnstructuredPoints.get_connectivity_as_matrix()
UnstructuredPoints.get_coordinate()
UnstructuredPoints.get_coordinate_name()
UnstructuredPoints.get_coordinate_units()
UnstructuredPoints.get_dim_count()
UnstructuredPoints.get_max_vertices()
UnstructuredPoints.get_offset()
UnstructuredPoints.get_point_coordinates()
UnstructuredPoints.get_point_count()
UnstructuredPoints.get_vertex_count()
UnstructuredPoints.get_x()
UnstructuredPoints.get_x_units()
UnstructuredPoints.get_xyz()
UnstructuredPoints.get_y()
UnstructuredPoints.get_y_units()
UnstructuredPoints.get_z()
UnstructuredPoints.get_z_units()
UnstructuredPoints.nodes_per_cell()
UnstructuredPoints.reverse_element_ordering()
UnstructuredPoints.set_x_units()
UnstructuredPoints.set_y_units()
UnstructuredPoints.set_z_units()
- pymt.grids.utils module
args_as_numpy_arrays()
assert_arrays_are_equal_size()
connectivity_matrix_as_array()
coordinates_to_numpy_matrix()
get_default_coordinate_names()
get_default_coordinate_units()
non_singleton_axes()
non_singleton_coordinate_names()
non_singleton_dimension_names()
non_singleton_dimension_shape()
non_singleton_shape()
- Module contents
DimensionError
RasterField
Rectilinear
RectilinearField
RectilinearPoints
Structured
StructuredField
StructuredPoints
UniformRectilinear
UniformRectilinearPoints
Unstructured
UnstructuredField
UnstructuredPoints
UnstructuredPoints.__init__()
UnstructuredPoints.get_attrs()
UnstructuredPoints.get_axis_coordinates()
UnstructuredPoints.get_cell_count()
UnstructuredPoints.get_connectivity()
UnstructuredPoints.get_connectivity_as_matrix()
UnstructuredPoints.get_coordinate()
UnstructuredPoints.get_coordinate_name()
UnstructuredPoints.get_coordinate_units()
UnstructuredPoints.get_dim_count()
UnstructuredPoints.get_max_vertices()
UnstructuredPoints.get_offset()
UnstructuredPoints.get_point_coordinates()
UnstructuredPoints.get_point_count()
UnstructuredPoints.get_vertex_count()
UnstructuredPoints.get_x()
UnstructuredPoints.get_x_units()
UnstructuredPoints.get_xyz()
UnstructuredPoints.get_y()
UnstructuredPoints.get_y_units()
UnstructuredPoints.get_z()
UnstructuredPoints.get_z_units()
UnstructuredPoints.nodes_per_cell()
UnstructuredPoints.reverse_element_ordering()
UnstructuredPoints.set_x_units()
UnstructuredPoints.set_y_units()
UnstructuredPoints.set_z_units()
is_rectilinear()
is_structured()
is_uniform_rectilinear()
is_unstructured()
- pymt.mappers package
- Submodules
- pymt.mappers.celltopoint module
- pymt.mappers.esmp module
- pymt.mappers.imapper module
- pymt.mappers.mapper module
- pymt.mappers.pointtocell module
- pymt.mappers.pointtopoint module
- Module contents
- pymt.portprinter package
- Submodules
- pymt.portprinter.port_printer module
- pymt.portprinter.utils module
BadFileFormatError
DimensionError
Error
construct_file_name()
construct_port_as_field()
data_is_centered_on_cells()
data_is_centered_on_points()
find_unknown_dimension()
fix_unknown_shape()
format_to_file_extension()
get_data_centering()
is_rectilinear_port()
is_structured_port()
mesh_size_has_changed()
next_unique_file_name()
normalize_format_name()
port_is_one_point()
positive_dimensions()
reconstruct_port_as_field()
- Module contents
- pymt.printers package
- pymt.services package
- pymt.testing package
- Submodules
- pymt.testing.ports module
- pymt.testing.services module
AirPort
EarthPort
EmptyPort
EmptyPort.current_time
EmptyPort.end_time
EmptyPort.finalize()
EmptyPort.get_component_name()
EmptyPort.get_grid_origin()
EmptyPort.get_grid_shape()
EmptyPort.get_grid_spacing()
EmptyPort.get_value()
EmptyPort.get_var_grid()
EmptyPort.get_var_units()
EmptyPort.initialize()
EmptyPort.run()
EmptyPort.set_value()
EmptyPort.start_time
EmptyPort.time_step
WaterPort
get_class()
get_class_names()
get_instance()
instantiate()
- Module contents
- pymt.utils package
Submodules¶
pymt.errors module¶
pymt.model_collection module¶
pymt.models module¶
pymt.timeline module¶
Execute events along a timeline.
Examples
>>> timeline = Timeline()
>>> timeline.add_recurring_event('event 1', 1.)
>>> timeline.add_recurring_event('event 2', .3)
>>> timeline.pop()
'event 2'
>>> timeline.pop()
'event 2'
>>> timeline.pop()
'event 2'
>>> timeline.pop()
'event 1'
>>> timeline.time
1.0
>>> for event in timeline.iter_until(2.0): print(event)
event 2
event 2
event 2
event 1
>>> timeline.pop()
'event 2'
When events occur at the same time, events are popped in as first-in, first-out.
>>> timeline = Timeline([('event 1', 1.), ('event 2', .5)])
>>> for event in timeline.iter_until(1.0): print(event)
event 2
event 1
event 2
>>> timeline = Timeline([('event 2', .5), ('event 1', 1.)])
>>> timeline.pop_until(1.05)
['event 2', 'event 1', 'event 2']
>>> timeline.time
1.05
>>> for event in timeline.iter_until(1.05): print(event)
>>> timeline.time
1.05
>>> for event in timeline.iter_until(1.06): print(event)
>>> timeline.time
1.06
The event key can be any object, even a tuple.
>>> timeline = Timeline([(('event', 2), .5), (('event', 0), 1.)])
>>> for event in timeline.iter_until(1.05): print(event)
('event', 2)
('event', 0)
('event', 2)
Events do not have to be recurring.
>>> timeline = Timeline([(('event', 2), .5), (('event', 0), 1.)])
>>> timeline.add_one_time_event('one-timer', .1)
>>> for event in timeline.iter_until(1.05): print(event)
one-timer
('event', 2)
('event', 0)
('event', 2)
- class pymt.timeline.Timeline(events=None, start=0.0)[source]¶
Bases:
object
Create a timeline of events.
- Parameters:
events (dict-like) – Events as event-object/repeat interval pairs.
start (float, optional) – Start time for the timeline.
Examples
Create a timeline with two recurring events. Events can be any old object. In this case they are two strings.
>>> timeline = Timeline([('hello', 1.), ('world', 1.5)], start=3.) >>> sorted(timeline.events) # The events are returned as a set. ['hello', 'world']
The first events will not occur at the starting time.
>>> timeline.time 3.0 >>> timeline.next_event 'hello' >>> timeline.time_of_next_event 4.0
To advance the timeline forward to the next event, use the pop method.
>>> timeline.pop() 'hello' >>> timeline.time 4.0 >>> timeline.pop() 'world' >>> timeline.time 4.5
The timeline keeps track of objects, without making copies. The objects don’t even need to be hashable.
>>> hello = ['hello', 'world'] >>> timeline = Timeline([(hello, 1.)]) >>> event = timeline.pop() >>> event is hello True >>> event.append('!') >>> hello ['hello', 'world', '!']
- add_one_time_event(event, time)[source]¶
Add an event that will only happen once.
- Parameters:
event (event-like) – Event to add to the timeline.
time (float) – Time for the event to execute.
Examples
>>> timeline = Timeline() >>> timeline.add_one_time_event('say hello', 1.) >>> timeline.time_of_next_event 1.0 >>> timeline.pop() 'say hello' >>> timeline.time_of_next_event Traceback (most recent call last): IndexError: empty timeline
- add_recurring_event(event, interval)[source]¶
Add a recurring event to the timeline.
Adds a single recurring event to the timeline. event is the event object, and interval is recurrence interval.
- Parameters:
event (event-like) – Event to add to the timeline.
interval (float) – Recurrence interval of the event.
Examples
>>> timeline = Timeline() >>> timeline.add_recurring_event('say hello', 1.) >>> timeline.events == {'say hello'} True
- add_recurring_events(events)[source]¶
Add a series of recurring events to the timeline.
Adds recurring events to the timeline. events is a list where each element is tuple that gives the event object followed by the event recurrence interval.
- Parameters:
events (dict-like) – Events object/interval pairs to add to the timeline.
Examples
>>> timeline = Timeline() >>> len(timeline.events) 0 >>> timeline.add_recurring_events([('hello', 1.), ('world', 1.)]) >>> sorted(timeline.events) ['hello', 'world']
Events pop as first-in, first-out.
>>> timeline.pop() 'hello' >>> timeline.pop() 'world'
The same event can be added multiple times.
>>> timeline = Timeline() >>> timeline.add_recurring_events([('hello', 1.), ('world', 1.), ... ('hello', 1.)]) >>> sorted(timeline.events) ['hello', 'world'] >>> timeline.pop_until(2.) ['hello', 'world', 'hello', 'hello', 'world', 'hello']
- property events¶
All of the event objects in the timeline.
Examples
>>> timeline = Timeline([('an event', 1.), ('another event', 1.)]) >>> events = timeline.events >>> isinstance(events, set) True >>> sorted(events) ['an event', 'another event']
- iter_until(stop)[source]¶
Iterate the timeline until a given time.
Iterate the timeline until stop, popping events along the way.
- Parameters:
stop (float) – Time to iterate until.
- Returns:
The next event object as the timeline advances to stop.
- Return type:
event
- property next_event¶
Next event object.
Return the next event object but don’t advance the timeline forward in time.
Examples
>>> timeline = Timeline([('an event', 1.)]) >>> timeline.next_event 'an event' >>> timeline.time 0.0
- pop()[source]¶
Pop the next event from the timeline.
Examples
>>> timeline = Timeline(dict(hello=1.)) >>> timeline.pop() 'hello'
- pop_until(stop)[source]¶
Advance the timeline, popping events along the way.
Advance the timeline to stop, popping events along the way. Returns a list of the event objects that were popped to advance the timeline to stop.
- Parameters:
stop (float) – Time to iterate until.
- Returns:
The events popped to get to the stop time.
- Return type:
list
Examples
>>> timeline = Timeline([('a', 1.), ('b', 1.), ('c', 1.)]) >>> timeline.pop_until(2.) ['a', 'b', 'c', 'a', 'b', 'c']
- property time¶
Current time along the timeline.
Examples
>>> timeline = Timeline(start=0) >>> timeline.time 0.0 >>> timeline = Timeline(start=2) >>> timeline.time 2.0
- property time_of_next_event¶
Time when the next event will happen.
Examples
>>> timeline = Timeline([('an event', 1.)]) >>> timeline.time_of_next_event 1.0
pymt.units module¶
Module contents¶
- class pymt.UnitSystem(filepath=None)¶
Bases:
_UnitSystem
A system of units.
A unit-system is a set of units that are all defined in terms of the same set of base units. In the SI system of units, for example, the base units are the meter, kilogram, second, ampere, kelvin, mole, and candela. (For definitions of these base units, see http://physics.nist.gov/cuu/Units/current.html)
In the UDUNITS-2 package, every accessible unit belongs to one and only one unit-system. It is not possible to convert numeric values between units of different unit-systems. Similarly, units belonging to different unit-systems always compare unequal.
- Parameters:
filepath (str, optional) – Path to a udunits2 xml-formatted unit database. If not provided, a default system of units is used.