wntr.morph.node module

The wntr.morph.node module contains functions to modify node coordinates.

wntr.morph.node.scale_node_coordinates(wn, scale, return_copy=True)[source]

Scales node coordinates, using 1:scale

Parameters
  • wn (wntr WaterNetworkModel) – Water network model

  • scale (float) – Coordinate scale multiplier, in meters

  • return_copy (bool, optional) – If True, modify and return a copy of the WaterNetworkModel object. If False, modify and return the original WaterNetworkModel object.

Returns

wntr WaterNetworkModel – Water network model with updated node coordinates

wntr.morph.node.translate_node_coordinates(wn, offset_x, offset_y, return_copy=True)[source]

Translate node coordinates

Parameters
  • wn (wntr WaterNetworkModel) – Water network model

  • offset_x (tuple) – Translation in the x direction, in meters

  • offset_y (float) – Translation in the y direction, in meters

  • return_copy (bool, optional) – If True, modify and return a copy of the WaterNetworkModel object. If False, modify and return the original WaterNetworkModel object.

Returns

wntr WaterNetworkModel – Water network model with updated node coordinates

wntr.morph.node.rotate_node_coordinates(wn, theta, return_copy=True)[source]

Rotate node coordinates counter-clockwise by theta degrees

Parameters
  • wn (wntr WaterNetworkModel) – Water network model

  • theta (float) – Node rotation, in degrees

  • return_copy (bool, optional) – If True, modify and return a copy of the WaterNetworkModel object. If False, modify and return the original WaterNetworkModel object.

Returns

wntr WaterNetworkModel – Water network model with updated node coordinates

wntr.morph.node.convert_node_coordinates_UTM_to_longlat(wn, zone_number, zone_letter, return_copy=True)[source]

Convert node coordinates from UTM coordinates to longitude, latitude coordinates

Parameters
  • wn (wntr WaterNetworkModel) – Water network model

  • zone_number (int) – Zone number

  • zone_letter (string) – Zone letter

  • return_copy (bool, optional) – If True, modify and return a copy of the WaterNetworkModel object. If False, modify and return the original WaterNetworkModel object.

Returns

wntr WaterNetworkModel – Water network model with updated node coordinates (longitude, latitude)

wntr.morph.node.convert_node_coordinates_longlat_to_UTM(wn, return_copy=True)[source]

Convert node longitude, latitude coordinates to UTM coordinates

Parameters
  • wn (wntr WaterNetworkModel) – Water network model

  • return_copy (bool, optional) – If True, modify and return a copy of the WaterNetworkModel object. If False, modify and return the original WaterNetworkModel object.

Returns

wntr WaterNetworkModel – Water network model with updated node coordinates (easting, northing)

wntr.morph.node.convert_node_coordinates_to_UTM(wn, utm_map, return_copy=True)[source]

Convert node coordinates to UTM coordinates

Parameters
  • wn (wntr WaterNetworkModel) – Water network model

  • utm_map (dictionary) – Dictionary containing two node names and their x, y coordinates in UTM easting, northing in the format {‘node name 1’: (easting, northing), ‘node name 2’: (easting, northing)}

  • return_copy (bool, optional) – If True, modify and return a copy of the WaterNetworkModel object. If False, modify and return the original WaterNetworkModel object.

Returns

wntr WaterNetworkModel – Water network model with updated node coordinates (easting, northing)

wntr.morph.node.convert_node_coordinates_to_longlat(wn, longlat_map, return_copy=True)[source]

Convert node coordinates to longitude, latitude coordinates

Parameters
  • wn (wntr WaterNetworkModel) – Water network model

  • longlat_map (dictionary) – Dictionary containing two node names and their x, y coordinates in longitude, latitude in the format {‘node name 1’: (longitude, latitude), ‘node name 2’: (longitude, latitude)}

  • return_copy (bool, optional) – If True, modify and return a copy of the WaterNetworkModel object. If False, modify and return the original WaterNetworkModel object.

Returns

wntr WaterNetworkModel – Water network model with updated node coordinates (longitude, latitude)