SEAScope.types package

Submodules

SEAScope.types.collection module

This module handles the serialization and deserialization of collection objects

SEAScope.types.collection.deserialize(buf)[source]

Rebuild a collection from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contains the collection object serialized with FlatBuffers

Returns:

The deserialized collection object as a dictionary. Note that the “defaultVariable” key is lost in the process.

Return type:

dict

SEAScope.types.collection.serialize(builder, collection_obj)[source]

Serialize a collection using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • collection_obj (dict) – Dictionary which contains information about the collection to serialize It must have ten keys:

    • mustBeCurrent : a bool which tells SEAScope how its temporal filter must be applied for this collection.

      When this setting is set to true, the viewer will ignore granules whose time range does not contain the current datetime. It is the recommended behavior for collections whose granules cover the whole globe.

      When it is set to false, the viewer displayed the granules of the collection as long as their time range intersects the current time window (cf. timespans in the list of settings for the application configuration file). Use this behavior for collections of granules with a smaller spatial footprint or a sparse temporal coverage.

    • xSeamless : a bool which tells SEAScope that the granules of the collection have a 360° longitudinal cover

    • ySeamless : a bool which tells SEAScope that the granules of the collection have a 180° latitudinal cover

    • NEWSAligned : a bool which tells SEAScope that the axes of the data matrix are aligned witth the South-North and West-East axes

    • label : a str that SEAScope uses to designate the collection

    • tags : a dict which contains tags that describe the collection. SEAScope considers a (key, value) pair as a tag.

    • variables : a list of dict containing information about the variables defined for the collection. Each dict objects must have all the keys required by SEAScope.types.variable.serialize()

    • defaultVariable : a int which is the index of the default item in the variables list

    • id : a dict whose content can be used by SEAScope as a unique identifier for the collection. It must have all the keys required by SEAScope.types.renderable_id.serialize()

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.collection_id module

This module handle the serialization of collection identifiers.

SEAScope.types.collection_id.deserialize(buf)[source]

Not implemented

SEAScope.types.collection_id.serialize(builder, colid_obj)[source]

Serializes a collection identifier using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • colid_obj (dict) – Dictionary which contains information about the collection to serialize It must have two keys:

    • sourceId : an int that identifies the data source which owns the collection

    • collectionId : an int that identifies the collection within the data source it belongs to

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.color module

This module handles the serialization and deserialization of color values

SEAScope.types.color.deserialize(o)[source]

Rebuild a color from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contains the color object serialized with FlatBuffers

Returns:

The deserialized color object as a list of 3 int (R, G and B)

Return type:

dict

SEAScope.types.color.serialize(builder, color_obj)[source]

Serialize a rendering configuration using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • color_obj (list of 3 int) – The color described by its red, green and blue channels

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.data_bucket module

This module handles the serialization of data bucket objects

SEAScope.types.data_bucket.deserialize(o)[source]

Not implemented

SEAScope.types.data_bucket.serialize(builder, bucket_obj)[source]

Serialize a data bucket using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • bucket_obj (dict) – Dictionary which contains information about the data bucket to serialize. It must have 2 keys:

    • info : a dict providing information about the data contained in the bucket. It must have all the keys required by SEAScope.types.data_info.serialize()

    • data : a list of numpy.uint8 which contains values packed as unsigned bytes

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.data_info module

This module handles the serialization of data info objects

SEAScope.types.data_info.data_types = {'float32': 4, 'none': 0, 'uint32': 3, 'uint8': 1, 'ushort16': 2}

Data types that can be used to store information in SEAScope. Beware: SEAScope expects some values to have a specific type and will probably crash or return an error if a value with another type is provided.

Type:

dict

SEAScope.types.data_info.deserialize(o)[source]

Not implemented

SEAScope.types.data_info.serialize(builder, info_obj)[source]

Serialize a granule data info using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • info_obj (dict) – Dictionary which contains information about the data to serialize

    It must have keys:

    • offsets : a list of float for the offset used when packing the data values (packed = (values - offset) / scale).

      One value per channel contained in the data matrix

    • scaleFactors : a list of float for the scale factors used when packing the data values (packed = (values - offset) / scale)

      One value per channel contained in the data matrix

    • fillValues : a list of float for the fill values that have been stored in the data matrix to replace missing/invalid data. Note that the fill values in this list belong to the packed values domain.

      One value per channel contained in the data matrix

    • dataType : a str which identifies the type to allocate for the values contained in the data matrix. Its value must be a key of the SEAScope.types.data_info.data_types` dictionary.

      Only uint8 is supported at the moment

    • channels : an int for the number of channels/fields contained in the data matrix

    • xArity : an int which tells SEAScope how many columns it must allocate when reconstructing the data matrix

    • yArity : an int which tells SEAScope how many rows it must allocate when reconstructing the data matrix

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.extraction module

This module handles the deserialization of extraction objects

SEAScope.types.extraction.deserialize(o)[source]

Rebuild an extraction from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contain the extraction object serialized with FlatBuffers

Returns:

The deserialized extraction object as a dictionary.

Return type:

dict

SEAScope.types.extraction.serialize(builder, obj)[source]

Not implemented

SEAScope.types.gcp module

This module handles the serialization and deserialization of GCP objects

SEAScope.types.gcp.deserialize(o)[source]

Rebuild a GCP from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contain the GCP object serialized with FlatBuffers

Returns:

The deserialized GCP object as a dictionary.

Return type:

dict

SEAScope.types.gcp.serialize(builder, gcp_obj)[source]

Serialize a GCP using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • gcp_obj (dict) – Dictionary which contains information about the GCP to serialize

    It must have four keys:

    • lon : a float which gives the longitude of the GCP

    • lat : a float which gives the latitude of the GCP

    • i : an int which is the number of the column in the data matrix for the GCP

    • j : an int which is the number of the row in the data matrix for the GCP

    There is a fifth optional key:

    • time : a int which is the number of milliseconds since epoch for the GCP. The default value is 0 if this key is not provided.

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.granule_data module

This module handles the serialization of granule data objects

SEAScope.types.granule_data.deserialize(o)[source]

Not implemented

SEAScope.types.granule_data.serialize(builder, data_obj)[source]

Serialize a granule data using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • data_obj (dict) – Dictionary which contains information about the granule data to serialize. Its keys must be the name of the data fields and its values must be dict objects that satisfy the requirements of the SEAScope.types.data_bucket.serialize() method

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.granule_metadata module

This module handles the serialization and deserialization of granule metadata objects

SEAScope.types.granule_metadata.data_models = {'LAT_LON': 0, 'NJ_NI': 2, 'ROW_CELL': 3, 'TIME': 5, 'TIME_STATION': 4, 'Y_X': 1}

Data models supported by SEAScope.

Type:

dict

SEAScope.types.granule_metadata.deserialize(o)[source]

Rebuild a granule metadata from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contains the granule metadata object serialized with FlatBuffers

Returns:

The deserialized granule metadata object as a dictionary.

Return type:

dict

SEAScope.types.granule_metadata.serialize(builder, obj)[source]

Serialize a granule metadata using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • obj (dict) – Dictionary which contains information about the shape to serialize It must have between 8 and 21 keys:

    • sourceId : an int which is the unique identifier for the source which provides the granule

    • collectionId : an int which is the unique identifier (within the data source) for the collection that owns the granule

    • granuleId : an int which is the unique identifier (within the data source) for the granule

    • dataId : a str which is the name of the granule. As for the granuleId it should remain unique within a data source

    • dataModel : a str that identifies the data model used to store the granule data. The value must be a key of the SEAScope.types.granule_metadata.data_models dictionary

    • start : an int which is the first time when data is available in the granule, in milliseconds since 1970-01-01T00:00:00.000Z

    • stop : an int which is the first time after start when data is not available anymore, in milliseconds since 1970-01-01T00:00:00.000Z

    • uris : a list of dict. The elements of the list describe the files attached to the granule and must satisfy the requirements of the SEAScope.types.idf_descriptor.serialize() method

    • title : an optional str for the title/long name of the granule

    • institution : an optional str for the name of the institution which provided the granule

    • comment : an optional str for any comment about the granule

    • file_id : an optional str for an identifier or path of the original file which has been converted to IDF

    • product_version: an optional str for the version of the product

    • lon_min : an optional float for the min longitude of the spatial coverage

    • lon_max : an optional float for the max longitude of the spatial coverage

    • lat_min : an optional float for the min latitude of the spatial coverage

    • lat_max : an optional float for the max latitude of the spatial coverage

    • creator_email: an optional str the email address of the person who generated the IDF file

    • station_id : an optional str for the unique identifier of the station that provided the measurements contained in the granule

    • platform : an optional str for the name or identifier of the platform which hosts the sensors that provided the measurements

    • sensor : an optional str for the name or identifier of the sensor that measured the values contained in the granule

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.idf_descriptor module

This module handles the serialization and deserialization of IDF descriptor objects

SEAScope.types.idf_descriptor.deserialize(o)[source]

Rebuild an IDF descriptor from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contain the IDF descriptor object serialized with FlatBuffers

Returns:

The deserialized IDF descriptor object as a dictionary.

Return type:

dict

SEAScope.types.idf_descriptor.serialize(builder, obj)[source]

Serialize an IDF descriptor using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • obj (dict) – Dictionary which contains information about the IDF descriptor to serialize

    It must have 6 keys:

    • uri : a str which is the address where SEAScope will find the granule

    • resolution : a float which is the resolution, in meters per cell of data, of the granule

    • subsampling_factor : an int which tells SEAScope how many times the data contained in the granule have been subsampled (by 2) compared to the full resolution data

    • xArity : an int which tells SEAScope how many columns it must allocate when reconstructing the data matrix

    • yArity : an int which tells SEAScope how many rows it must allocate when reconstructing the data matrix

    • shape : a dict that describes the shape of the granule. The value must satisfy the requirements of the SEAScope.types.shape.serialize() method

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.renderable_id module

This module handles the serialization and deserialization of the identifiers for renderable objects.

SEAScope.types.renderable_id.deserialize(o)[source]

Rebuild an identifier for a renderable object from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contain the renderable ID object serialized with FlatBuffers

Returns:

The deserialized renderable ID object as a dictionary.

Return type:

dict

SEAScope.types.renderable_id.serialize(builder, rid_obj)[source]

Serialize a renderable ID using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • rid_obj (dict) – Dictionary which contains information about the renderable ID to serialize

    It must have 5 keys:

    • granuleLevel : a bool that tells SEAScope if the targeted object is a granule (True) or a collection (False)

    • sourceId : a int which is the unique identifier of the data source which provided the targeted object

    • collectionId : a int which is the unique identifier (within the data source) of the targeted collection

    • granuleId : a int which is the unique identifier (within the data source) of the targeted granule

      Ignored if granuleLevel is False

    • variableId :a int which is the unique identifier (within the collection) of the targeted variable

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.rendering_cfg module

This module handles the serialization and deserialization of rendering configuration objects

SEAScope.types.rendering_cfg.deserialize(o)[source]

Rebuild a rendering configuration from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contain the rendering configuration object serialized with FlatBuffers

Returns:

The deserialized rendering configuration object as a dictionary.

Return type:

dict

SEAScope.types.rendering_cfg.filter_modes = {'BILINEAR': 1, 'NEAREST': 0}

Rendering filters available in SEAScope. These filters are applied for mapping pixels with data.

Type:

dict

SEAScope.types.rendering_cfg.rendering_methods = {'ARROWS': 1, 'BARBS': 2, 'DOTSCLOUD': 4, 'RASTER': 0, 'RAWRGB': 6, 'STREAMLINES': 5, 'TRAJECTORIES': 3}

Methods for rendering data in SEAScope.

Note that DOTSCLOUD is not supported by the current version of SEAScope

Type:

dict

SEAScope.types.rendering_cfg.serialize(builder, cfg_obj)[source]

Serialize a rendering configuration using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • cfg_obj (dict) – Dictionary which contains information about the rendering configuration to serialize

    It must have 15 keys:

    • rendered : a bool telling SEAScope if the associated target should be rendered or not (only relevant for collections)

    • logscale : a bool telling SEAScope to use a logarithmic scale when applying the colormap (True) or the default linear scale (False)

    • min : a float that SEAScope must use as the minimal value when applying the colormap

    • max : a float that SEAScope must use as the maximal value when applying the colormap

    • opacity : a float giving the opacity of the target. Its value belongs to the [0.0, 1.0] range: 0.0 is fully transparent, 1.0 is completely opaque

    • zindex : a float that SEAScope uses to decide in which order the data should be rendered. Granules with a low zindex are rendered before granules with a high zindex

    • colormap : a str which identifies the colormap applied to the representation of the variable.

      A colormap identifier is only valid if there is a file in the colormaps directory whose name is the identifier suffixed by the .rgb extension.

    • renderMethod : a str that tells SEAScope which rendering method must be used to display the variable. The value should be a key of the SEAScope.types.rendering_cfg.rendering_methods dictionary

    • particlesCount : an int which sets the size of the pool of animated particles.

      This value controls the density of the particles when using the streamlines rendering method.

      Increasing the density adds a toll on the GPU and may significatively reduce fluidity.

    • particleTTL : an int (deprecated)

    • streamlineLength : an int which tells SEAScope how many segments each streamline should be made of

    • streamlineSpeed : a float (deprecated)

    • filterMode : a str that tells SEAScope which filter to use when mapping pixels with data values. The value must be a key of the SEAScope.types.rendering_cfg.filter_modes dictionary

    • target : a dict that identifies the target of the rendering configuration. The value must satisfy the requirements of the SEAScope.types.renderable_id.serialize() method.

    • color : a dict describing the uniform color that SEAScope will apply when rendering the target. The value must satisfy the requirements of the SEAScope.types.color.serialize() method.

      If both color and colormap are defined, then the colormap will be used and the color will be ignored.

    • billboardsSize : a :obj:float used by SEAScope to define the size of symbols when rendering data as arrows or barbs.

    • billboardsDensity : a :obj:float value between 0.0 and 1.0 that SEAScope uses to compute how many symbols it must draw when using the arrows or barbs renderers. A value of 0.0 means that symbols will be separated by a blank space which has the same size as one symbol. A value of 1.0 means that there is no blank space between visible symbols.

    • lineThickness : a :obj:float that tells SEAScope how thick lines should be (in pixels) when drawing trajectories or polylines.

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.shape module

This module handles the serialization and deserialization of shape objects

SEAScope.types.shape.deserialize(o)[source]

Rebuild a shape from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contains the shape object serialized with FlatBuffers

Returns:

The deserialized shape object as a dictionary.

Return type:

dict

SEAScope.types.shape.serialize(builder, shp_obj)[source]

Serialize a shape using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • shp_obj (dict) – Dictionary which contains information about the shape to serialize It must have three keys:

    • xArity : an int which tells SEAScope how many columns it must allocate when reconstructing the GCPs matrix

    • yArity : an int which tells SEAScope how many rows it must allocate when reconstructing the GCPs matrix

    • gcps : a list of dict containing information about the GCPs of the shape. Each dict object must have all the keys required by SEAScope.types.gcp.serialize()

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.source module

This module handles the serialization and deserialization of source objects

SEAScope.types.source.deserialize(o)[source]
SEAScope.types.source.serialize(builder, src_obj)[source]

Serialize a source using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • src_obj (dict) – Dictionary which contains information about the source to serialize It must have ten keys:

    • title : a str that SEAScope uses to designate the source

    • description: a str that SEAScope can display to provide information about the source

    • tags : a dict which contains tags that describe the collection. SEAScope considers a (key, value) pair as a tag.

    • id : an int that SEAScope can uses as a unique identifier for the source

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.tag module

This module handles the serialization and deserialization of tag objects

SEAScope.types.tag.deserialize(t)[source]

Rebuild a tag from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contains the tag object serialized with FlatBuffers

Returns:

The deserialized tag as a (name, value) pair.

Return type:

tuple(str, str)

SEAScope.types.tag.serialize(builder, name, value)[source]

Serialize a timestep using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • name (str) – Name of the tag

  • value (str) – Value of the tag. If the tag value is not a string, make sure to convert it to str before passing it to this method

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.timespan module

This module handles the serialization and deserialization of timespan objects

SEAScope.types.timespan.deserialize(o)[source]

Rebuild a timespan from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contains the timespan object serialized with FlatBuffers

Returns:

The deserialized timespan object as a dictionary.

Return type:

dict

SEAScope.types.timespan.serialize(builder, span_obj)[source]

Serialize a timespan using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • span_obj (dict) – Dictionary which contains information about the timespan to serialize It must have three keys:

    • label : a str displayed by SEAScope to designate this timespan

    • pastOffset : an int that tells SEAScope when the timespan starts, as a positive number of seconds relative to SEAScope current datetime, i.e. start = current - pastOffset

    • futureOffset : an int that tells SEAScope when the timespan ends, as a positive number of seconds relative to SEAScope current datetime, i.e. end = current + futureOffset

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.timestep module

This module handles the serialization and deserialization of timestep objects

SEAScope.types.timestep.deserialize(o)[source]

Rebuild a timestep from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contains the timestep object serialized with FlatBuffers

Returns:

The deserialized timestep object as a dictionary.

Return type:

dict

SEAScope.types.timestep.serialize(builder, step_obj)[source]

Serialize a timestep using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • step_obj (dict) – Dictionary which contains information about the timestep to serialize It must have two keys:

    • label : a str displayed by SEAScope to designate this timestep

    • step : an int that gives the size of the step in seconds

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

SEAScope.types.variable module

This module handles the serialization and deserialization of variable objects

SEAScope.types.variable.deserialize(v)[source]

Rebuild a variable from a FlatBuffers buffer.

Parameters:

buf (bytearray) – The buffer which contains the variable object serialized with FlatBuffers

Returns:

The deserialized variable object as a dictionary.

Return type:

dict

SEAScope.types.variable.serialize(builder, var_obj)[source]

Serialize a variable using FlatBuffers.

Parameters:
  • builder (flatbuffers.builder.Builder) – The FlatBuffers builder instance which serializes data. If this parameter is None, then a new builder will be created

  • var_obj (dict) – Dictionary which contains information about the variable to serialize It must have five keys:

    • label : a str that SEAScope uses to designate the variable

    • units : a str for the units of the variable

    • fields : a list of str which contains the name of the data fields that must be read in order to recompose the variable. For example the U and V components for a vectorfield, or three channels for RGB images

    • tags : a dict which contains tags that describe the variable. SEAScope considers a (key, value) pair as a tag.

    • defaultRenderingMethod : a str that designates the rendering method that must be used by default for this variable. This parameter must be one of the keys of the SEAScope.types.rendering_cfg.rendering_methods dictionary

Returns:

A tuple which contains two elements:

  • the flatbuffers.builder.Builder instance which has been used to serialize data

  • an int which is the address/offset of the serialized object in the builder buffer

Return type:

tuple(flatbuffers.builder.Builder, int)

Module contents