pyisg#
Library reading/writing the ISG 2.0 format.
This provides APIs, such as load(), loads(), dump() and dumps().
import pyisg
# serialize to ISG 2.0 format str to dict
with open("file.isg") as fs:
obj = pyisg.load(fs)
# deserialize to ISG 2.0 format str
s = pyisg.dumps(obj)
One can install pyisg from PyPI
pip install pyisg
- Licence
MIT or Apache-2.0
- Reference
Specification: https://www.isgeoid.polimi.it/Geoid/format_specs.html
pyisg package#
Submodules#
Module contents#
Provides serialize/deserialize API of ISG 2.0 format.
- class pyisg.ISGFormatType#
Bases:
TypedDictType of ISG data dict.
- comment: str#
- header: HeaderType#
- data: list[list[float | None]] | list[tuple[DmsCoordType | float, DmsCoordType | float, float]]#
- pyisg.loads(s: str) ISGFormatType#
Deserialize ISG 2.0 format
strobj todictobj.- Parameters:
s – ISG 2.0 format
strobj- Returns:
dict of ISG data
- Raises:
DeserializeError – deserialization failed
- pyisg.load(fp: TextIO) ISGFormatType#
Deserialize ISG 2.0 file-like obj to
dictobj.- Parameters:
fp – file-like obj of ISG 2.0 format data
- Returns:
dict of ISG data
- Raises:
DeserializeError – deserialization failed
- pyisg.dumps(obj: Any) str#
Serialize
ISGFormatType-like obj intostrobj.- Parameters:
obj –
ISGFormatType-like obj (Mapping-like obj)- Raises:
SerializeError – serialization failed
pyo3_runtime.PanicException – data has
Noneeven when nodata isNone
- pyisg.dump(obj: Any, fp: TextIO) int#
Serialize
ISGFormatTypelike obj into file-like obj.- Parameters:
obj –
ISGFormatType-like obj (Mapping-like obj)fp – output file-like obj
- Returns:
The number of characters written
- Raises:
SerializeError – serialization failed
pyo3_runtime.PanicException – data has
Noneeven when nodata isNone
pyisg.types module#
Provides definition of types.
- class pyisg.types.ISGFormatType#
Bases:
TypedDictType of ISG data dict.
- comment: str#
- header: HeaderType#
- data: list[list[float | None]] | list[tuple[DmsCoordType | float, DmsCoordType | float, float]]#
- class pyisg.types.HeaderType#
Bases:
TypedDictType of Header dict.
- model_name: str | None#
- model_year: str | None#
- model_type: ModelTypeType | None#
- data_type: DataTypeType | None#
- data_units: DataUnitsType | None#
- data_format: Required[DataFormatType]#
- data_ordering: DataOrderingType | None#
- ref_ellipsoid: str | None#
- ref_frame: str | None#
- height_datum: str | None#
- tide_system: TideSystemType | None#
- coord_type: Required[CoordTypeType]#
- coord_units: Required[CoordUnitsType]#
- map_projection: str | None#
- EPSG_code: str | None#
- lat_min: CoordType | None#
- lat_max: CoordType | None#
- north_min: CoordType | None#
- north_max: CoordType | None#
- lon_min: CoordType | None#
- lon_max: CoordType | None#
- east_min: CoordType | None#
- east_max: CoordType | None#
- delta_lat: CoordType | None#
- delta_lon: CoordType | None#
- delta_north: CoordType | None#
- delta_east: CoordType | None#
- nrows: Required[int]#
- ncols: Required[int]#
- nodata: float | None#
- creation_date: CreationDateType | None#
- ISG_format: Required[str]#