SourceInv class

class csi.SourceInv(name, utmzone=None, ellps='WGS84', lon0=None, lat0=None)

Class implementing the geographical transform. This class will be parent to almost all the classes in csi.

You can specify either an official utm zone number or provide longitude and latitude for a custom zone.

Args:
  • name : Instance Name

  • utmzone : UTM zone (optional, default=None)

  • lon0 : Longitude defining the center of the custom utm zone

  • lat0 : Latitude defining the center of the custom utm zone

  • ellps : ellipsoid (optional, default=’WGS84’)

ll2xy(lon, lat)

Do the lat/lon to UTM transform. Input is in degrees. UTM coordinates are returned in km.

Args:
  • lon : Longitude (deg)

  • lat : Latitude (deg)

Returns:
  • x : UTM coordinate x (km)

  • y : UTM coordinate y (km)

set_utmzone(utmzone=None, ellps='WGS84', lon0=None, lat0=None)

Sets the UTM zone in the class. Zone can be specified via its international number or one can specify the center of a custom UTM zone via lon0, lat0.

Kwargs:
  • ellps : Reference Ellipsoid

Method 1:
  • utmzone : International UTM zone number

Method 2:
  • lon0 : Longitude of the center of the custom UTM zone (deg)

  • lat0 : Latitude of the center of the custom UTM zone (deg)

unset_utmzone()

Unsets the UTM zone. Basically, TransformerLocal object (pyproj) cannot be pickled. Therefore, if one wants to pickle the fault object (which is important for deepcopy or multiprocessing), one needs to delete the proj instance before. This is a temporary hack until proj fixes the bug.

I raised a bug issue in the pyproj github project (issue #1058)

xy2ll(x, y)

Do the UTm to lat/lon transform. Input is in km. Output is in degrees.

Args:
  • x : UTM longitude (km).

  • y : UTM latitude (km)

Returns:
  • lon : Longitude (degrees)

  • lat : Latitude (degree)