Coder Social home page Coder Social logo

extract_profile's Introduction

extract_profile

Extract a profile along a vector (i.e., geopackage or shapefile), through a raster (i.e., netCDF or geotiff). Uses python and packages.

Dependencies include the python packages numpy, scipy, xarray, geopandas, gdal, and fiona.

Given coordinates of profile vertices within a shapefile, create a line of evenly spaced points along the vector, then sample the values of the geotiff raster at the evenly spaced points. This function is essentially a geospatial wrapper script of scipy.ndimage's map_coordinates function, that also creates an evenly-spaced, length vector for use in sampling the raster.

This script is useful for purposes such as pulling topographic profiles out of DEMs, or velocity profiles from remotely-sensed velocity fields.

Here's the header information from extract_profile.py, that describes the inputs and outputs:

    Extracts an evenly spaced profile, defined along a vector polyline,
    from a netCDF or geotiff.
    
    Inputs include:
        raster: a netCDF or geotiff file passed as a string (with path).  File is
                    expected to have units of meters.
        line_file: a vector-based (string of filename, with path) consisting
                    of only one polyline along which to extract the 
                    profile values.
        ds: the spacing of points along the polyline at which to extract
                    profile values from the geotiff, assumed to be in meters.
        var: data variable name to use for extracting the profile through
                    
    Returns include:
        disti: a vector (np.array) of evenly-space distances along
                    the shapefile.
        profile: values drawn from raster at the distances of disti.
        xi: the interpolated, evenly spaced x coordinates along the line_file,
                    at which the disti and profile values are defined.
        yi: the interpolated, evenly spaced y coordinates along the line_file,
                    at which the disti and profile values are defined.                    
        
        

extract_profile's People

Contributors

tbartholomaus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.