Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • kadlu kadlu
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 17
    • Issues 17
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • public_projects
  • kadlukadlu
  • Issues
  • #3

Closed
Open
Created Dec 12, 2018 by Oliver Kirsebom@kirsebomOwner

Bathymetry provider class

Objective: Implement classes to handle bathymetry data.

Proposed structure:

class BathymetryProvider():
  """ Provide interpolated bathymetry data.
      
      Args: 
        bathy_reader: BathyNetCDFReader or BathyMatlabReader
          Bathymetry data file reader
  """
  def __init__(self, bathy_reader):
    self.reader = bathy_reader
 
  def interpXY(self, ...):
    """ Interpolate bathymetry grid in position coordinates (XY).

        Returns:
          bathy_field: Interpolation function
    """
    lat, lon, bathy = self.reader.read()
    ...
    return bathy_field

  def interpLL(self, ...):
    """ Interpolate bathymetry grid in latitude and longitude coordinates (LL).

        Returns:
          bathy_field: Interpolation function
    """
    ...
    return bathy_field


LatLon = namedtuple('LatLon', ['latitude', 'longitude'])
""" Latitude and longitude coordinates for a given location.
      
    Args: 
      latitude: float
        Latitude in degrees from -90 (South Pole) to +90 (North Pole).
      longitude: float
        Longitude in degrees from -180 to +180 (West to East) with 0 
        corresponding to the Greenwich Meridian.
"""

class BathyNetCDFReader():
  """ Extract bathymetry data from netCDF file.
      
      Args: 
        path: str
          File name including path.
        lat_name: str
          Name of the variable in the netCDF file that contains the latitue values.
        lon_name: str
          Name of the variable in the netCDF file that contains the longitude values.
        bathy_name: str
          Name of the variable in the netCDF file that contains the bathymetry values.
  """
  def __init__(self, path, lat_name='lat', lon_name='lon', bathy_name='bathy'):
    self.path = path
    self.lat_name = lat_name
    self.lon_name = lon_name
    self.bathy_name = bathy_name
  
  def read(latlon_NW=None, latlon_SE=None):
    """ Read longitude, latitude, and bathymetry matrices from file.

        Args: 
          latlon_NW: LatLon
            North-western (NW) boundary of the region of interest.
          latlon_SE: LatLon
            South-eastern (SE) boundary of the region of interest.

        Returns:
          lat: 1d numpy array
            Latitude values
          lon: 1d numpy array
            Longitude values
          bathy: 2d numpy array
            Bathymetry values
    """
    ...
    return lat, lon, bathy
Edited Dec 21, 2018 by Oliver Kirsebom
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking