System

Inheritance diagram of gspy.gs_dataset.System
class gspy.gs_dataset.System.System(xarray_obj)
check_against_data(dataset)

Assert that gate time strings match the coordinates of the attached dataset.

classmethod from_dict(**kwargs)
classmethod from_stm(stm, **kwargs)

A system built from a GA-AEM .stm file.

Takes the same arguments as metadata_from_stm() and builds what it returns. A time domain .stm carries its own gate times and waveform, so this yields a system on its own; pass the rest in metadata to fill in what the file cannot say.

Return type:

xarray.Dataset

property is_projected

Does the dataset have a projected spatial reference

Returns:

out

Return type:

bool

classmethod metadata_from_stm(stm, domain=None, name=None, receivers=None, metadata=None)

System metadata read from a GA-AEM .stm file, over a template.

Parameters:
  • stm (str or dict) – The file, or {transmitter label: file} where a moment is a file of its own. The labels are the transmitters, in the order given.

  • domain (str, optional) – ‘time’ or ‘frequency’, where the file does not say or says wrongly. Worked out from the file by default.

  • name (str, optional) – What to file the system under, as in metadata_template().

  • receivers (int or list of str, optional) – The receivers. Taken from which components the file scales by default.

  • metadata (str or dict, optional) – What you already know, or the yml holding it. Wins over the file. A yml written as one <name>_system: entry is unwrapped, and names the system.

Returns:

{name: the system}, ready to build, or to dump and fill in.

Return type:

gspy.Metadata

Notes

A .stm is a forward modelling file, not a system description, so what it can answer it answers and the rest is left as template placeholders. It models an airborne dipole, so the mode is airborne and there is no loop geometry to ask for. Its normalised loop - one turn, one amp, one square metre, with the data scaled to match - is flagged rather than imported, because importing it would claim a 1 m^2 single turn loop. Anything read that GSPy has no field for is recorded in the attributes under stm_, so nothing in the file is lost.

Examples

A moment per file, read by two coils:

>>> System.from_stm({'LM': 'SkytemLM.stm', 'HM': 'SkytemHM.stm'},
...                 receivers=['z', 'x'], metadata='skytem_system.yml')

Or dump what the file knows and fill in the rest by hand:

>>> System.metadata_from_stm('Tempest.stm').dump('tempest_system.yml')
classmethod metadata_template(key, name=None, transmitters=None, receivers=None, metadata=None)

A metadata template for one system, shaped to its transmitters and receivers.

Parameters:
  • key (str) – Which method family to template, one of templates().

  • name (str, optional) – What to file the system under, f"{key}_system" by default. Must contain “system”, because that is what a container looks for when it lifts system definitions out of a dataset’s metadata.

  • transmitters (int or list of str, optional) – How many of each there are, or their labels. A count gives indexed labels. Both default to one. Where a family pairs its transmitters and receivers one to one, giving only one side mirrors it onto the other.

  • receivers (int or list of str, optional) – How many of each there are, or their labels. A count gives indexed labels. Both default to one. Where a family pairs its transmitters and receivers one to one, giving only one side mirrors it onto the other.

  • metadata (dict, optional) – What you already know about this system. Wins over the placeholders.

Returns:

{name: the system}, ready to merge into a dataset’s metadata.

Return type:

gspy.Metadata

Notes

Fields are repeated to match the shape asked for, and collapse to a single value where there is only one of something. Couplets are worked out from the two sets of labels: every receiver measures every transmitter, unless the family pairs them off, and anything named per transmitter - time domain gate times, say - is named after the transmitter label it belongs to.

A template is a skeleton, not a system. Its dimensions hold placeholders where real gate times or frequencies go, so it will not build until those are filled in, the same way Survey.metadata_template does not yield a coordinate reference system from wkid: '??'.

Examples

Two moments read by two coils, so four couplets:

>>> System.metadata_template('tdem', name='skytem_system',
...                          transmitters=['LM', 'HM'], receivers=['z', 'x'])

Six frequencies, each coil pair its own couplet:

>>> System.metadata_template('fdem', transmitters=6)
classmethod open(filename, name=None, **kwargs)

One system, read from a metadata file.

Parameters:
  • filename (str) – The file. A system is an entry named with “system” in it, which is how a container picks them out of a dataset’s metadata too, so a file written for a dataset can be opened here as well.

  • name (str, optional) – Which system to build. Only needed where the file holds more than one.

Return type:

xarray.Dataset

Raises:

ValueError – If the file holds no system, or holds several and none was asked for.

Examples

>>> System.open('Resolve_system.yml')
>>> System.open('skytem_system.yml', name='magnetic_system')
required_metadata: tuple[str, ...] = ('type', 'mode', 'method', 'instrument')

Attributes every GS dataset must carry. Subclasses narrow or widen this.

classmethod templates()

The method families that metadata_template can shape a template for.

Return type:

tuple of str

classmethod valid_instrument(**kwargs)
classmethod valid_method(**kwargs)
classmethod valid_model(**kwargs)