mapper.py

class sloth.mapper.mapper(SimLons=None, SimLats=None, ObsLons=None, ObsLats=None, ObsIDs=None, SimMeanQ=None, ObsMeanQ=None, SimMeanArea=None, ObsMeanArea=None)[source]

TBE

Due to several reasons (e.g. coarse resolutions) the river corridors within TSMP (as all other models) does not have to match the real corridor for all pixels along the river. […]

MapBestCatchment(search_rad=1, dx=12500.0, dy=12500.0, slopey=None, slopex=None)[source]

This functions maps OBS on SimGrid by choosing that pixel which related catchment area fits best to GRDC.

The best fitting catchment is found by calculating the catchment of each pixel within a given radius around the origin pixel. The origin pixel is hereby defined by MapRaw(). That pixel with catchment area closes to GRDC data is than set.

Parameters:
  • search_rad (int) – defining the radius around the origin pixel to search for best fitting catchment.

  • dy (float) – defining the y-resolution of slope-grid (in [m])

  • dx (float) – defining the x-resolution of slope-grid (in [m])

  • slopey (2D ndarray) – defining the ParFlow slopes in y-direction used to calculate the catchment

  • slopex (2D ndarray) – defining the ParFlow slopes in x-direction used to calculate the catchment

Return type:

None

Notes

This function sets / updates the object variables self.MapYIdx_fit, self.MapXIdx_fit, and self.SimMeanArea directly

MapBestQ(search_rad=1)[source]

This functions maps OBS on SimGrid by choosing that pixel with best fitting discharge (Q) within given radius.

The best fitting Q is found by calculating the discharge of each pixel within a given radius around the origin pixel. The origin pixel is hereby defined by MapRaw(). That pixel with Q closes to GRDC data is than set.

Parameters:

search_rad (int) – defining the radius around the origin pixel to search for best fitting Q.

Return type:

None

Notes

This function sets / updates the object variables self.MapYIdx_fit, and self.MapXIdx_fit directly

MapHighQ(search_rad=1)[source]

This functions maps OBS on SimGrid by choosing that pixel with highest discharge (Q) within given radius.

The highest discharge (Q) is simply found by applying np.argmax() to the subset (search_rad around origin pixel) of SimMeanQ. The origin pixel is hereby defined by MapRaw() SimMeanQ is part of the objects-variables

Parameters:

search_rad (int) – defining the radius around the origin pixel to search for highest Q.

Return type:

None

Notes

This function sets / updates the object variables self.MapYIdx_fit, and self.MapXIdx_fit directly

MapRaw()[source]

This functions straight forward maps OBS on SimGrid.

This function maps OBS data according to its Lat/Lon values to SimGrid, by calculating the ‘real’ distance between OBS location and all points in SimGrid. The point with the smallest distance is choose as the correct location of OBS on SimGrid. The ‘real’ distance is hereby the distance in [m] between OBS and SimGrind calculated on a sphere.

Return type:

None

Notes

This function sets / updates the object variables self.MapYIdx_fit, and self.MapXIdx_fit directly

spher_dist(lon1, lat1, lon2, lat2, Rearth=6373)[source]

calculate the spherical / haversine distance

Source: https://www.kompf.de/gps/distcalc.html This function is supposed to proper handle different shaped coords latX and lonX is supposed to be passed in rad

return 2D ndarray

writeMap2File(file)[source]

Write mapped coordinates to a given file.

To save mapped coordinates for later use or better comparison, one can write / dump those to a file. Currently this function does only write data to CSV-format. Currently already existing files are overwritten.

Parameters:

file (str) – defining the file-path to which data should be written.

Return type:

None