Skip to content

Commit

Permalink
[nasadem] update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JayKickliter committed Jan 23, 2025
1 parent d1b0626 commit d0eea38
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions nasadem/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,17 +324,23 @@ impl Tile {
/// Retrieves the elevation sample from the tile at the specified
/// location.
///
/// The `loc` parameter defines the location to query and can be
/// The `idx` parameter specifies the location to query and can be
/// one of the following:
///
/// - `usize`: The linear index of the elevation sample in the data array.
/// - `(usize, usize)`: A 2D index representing the (x, y) position of the elevation sample.
/// - `Geo`: A geographic coordinate specifying an absolute location.
/// - `usize`: The linear index of the elevation sample in the
/// underlying data array, where `0` corresponds to the
/// northwest corner of the tile.
/// - `(usize, usize)`: A 2D index representing the `(x, y)`
/// position of the elevation sample, where `(0, 0)`
/// corresponds to the northwest corner of the tile.
/// - `Geo`: A geographic coordinate specifying an absolute
/// location in latitude and longitude.
///
/// # Returns:
/// # Returns
///
/// - `Some(Elev)` if the specified location is valid and contained within the tile.
/// - `None` if the location is outside the bounds of the tile or invalid.
/// - `Some(Elev)` if the location is valid and contained within
/// the tile.
/// - `None` if the location is out of bounds or invalid.
///
/// # Examples
///
Expand Down Expand Up @@ -364,7 +370,6 @@ impl Tile {
/// Some(3772)
/// );
/// ```
#[inline]
pub fn get<T>(&self, loc: T) -> Option<Elev>
where
TileIndex: From<T>,
Expand All @@ -386,15 +391,17 @@ impl Tile {
/// Retrieves the elevation sample from the tile at the specified
/// location.
///
/// The `loc` parameter defines the location to query and can be
/// The `idx` parameter specifies the location to query and can be
/// one of the following:
///
/// - `usize`: The linear index of the elevation sample in the
/// data array.
/// - `(usize, usize)`: A 2D index representing the (x, y)
/// position of the elevation sample.
/// - `Coord`: A geographic coordinate specifying an absolute
/// location.
/// underlying data array, where `0` corresponds to the
/// northwest corner of the tile.
/// - `(usize, usize)`: A 2D index representing the `(x, y)`
/// position of the elevation sample, where `(0, 0)`
/// corresponds to the northwest corner of the tile.
/// - `Geo`: A geographic coordinate specifying an absolute
/// location in latitude and longitude.
///
/// # Panics
///
Expand Down Expand Up @@ -526,9 +533,15 @@ impl Tile {
}
}

/// `TileIndex` represents the different ways of indexing into a
/// [`Tile`].
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TileIndex {
/// Plain old offset into the flat sample array.
Linear(usize),
/// Cartesean coordinates, where (0, 0) is the northwest corner.
XY((usize, usize)),
/// Absolute geographic coordinates.
Geo(Coord),
}

Expand Down

0 comments on commit d0eea38

Please sign in to comment.