Coder Social home page Coder Social logo

jnhansen / nd Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 2.0 98.05 MB

Framework for the analysis of n-dimensional, multivariate Earth Observation data

License: MIT License

Python 85.03% Cython 14.97%
earth-observation netcdf remote-sensing sar satellite-imagery xarray

nd's People

Contributors

jnhansen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

elfmanryan

nd's Issues

Allow manual specification of source CRS in nd.warp.reproject

The metadata of a dataset may get corrupted or not contain the CRS information. For those cases it should be possible to manually specify the source CRS in nd.warp.reproject, e.g. by adding an optional parameter src_crs.

Should probably throw a warning if src_crs differs from the CRS detected from metadata.

Command line tools

It could be useful to add a suite of command line tools:

  • nd-align — equivalent to nd.warp.align, align a number of input datasets.
  • nd-warp — equivalent to nd.warp.reproject, in analogy to gdalwarp (but working on multi-dimensional NetCDF files)
  • nd-filter
  • nd-classify

Include docstrings and proper signatures for xarray accessors

Need to include proper inline documentation for the xarray accesors.
There are two ways to do this:

  • manually add docstrings and parameters into the accessor methods,
  • or (much preferred) automatically patch docstring and signature, like for wrap_algorithm

Include default ways to deal with different data sources

Most of the remote sensing data has standardized variable names. The library should be able to infer the data source and type from the variable names, convert between different representations and perform different default actions (such as RGB representation) based on these representations.

This is especially relevant polarimetric SAR data, where data will usually be present in the covariance matrix representation, but may need to be converted to and from sigma0, beta0, gamma0 etc.

nd.vector requires scikit-learn

Import fails if scikit-learn is not installed because the vector module is using it.

Possible solutions:

  • Use a different implementation than the sklearn.preprocessing.LabelEncoder
  • Make import of nd.vector optional
  • Make scikit-learn a dependency

Related to #11

add to_tiff()

Add functionality for GeoTiff output from nd accessor

Could not find libgsl

Bug description

Steps to reproduce

Expected behavior

System (please complete the following information):

  • OS:
  • Package version [e.g. 0.1]:

Add method to create geographic map in nd.visualize

It would be great to have a method to create better visualizations of geographic data, e.g. using cartopy / geoviews / etc.

This would involve displaying the data as an overlay on a map, in an arbitrary projection.

  • by default, use the dataset projection but allow custom CRS
  • by default, use a buffered view around the data bounds but allow custom extent
  • allow clipping to Polygon
  • resample to desired resolution

Make OpenCV dependency optional

OpenCV is currently needed for lots of things in nd.visualize. Might consider replacing this with a lighter weight dependency or making it an optional dependency only required when calling the corresponding methods (i.e. to_rgb() and write_video()).

`test_reproject_with_extra_dims` sometimes fails on Python3.5

test_reproject_with_extra_dims sometimes fails:


___________________________________ test_reproject_with_extra_dims[dims4] ___________________________________

dims = {'band': 5, 'extra': 2, 'time': 10, 'x': 20, ...}

    @pytest.mark.parametrize('dims', [
        {'y': 20, 'x': 20, 'time': 10, 'band': 5},
        {'x': 20, 'y': 20, 'time': 10, 'band': 5},
        {'time': 10, 'band': 5, 'x': 20, 'y': 20},
        {'time': 10, 'x': 20, 'band': 5, 'y': 20},
        {'y': 20, 'x': 20, 'time': 10, 'band': 5, 'extra': 2}
    ])
    def test_reproject_with_extra_dims(dims):
        crs1 = _parse_crs('+init=epsg:4326')
        crs2 = _parse_crs('+init=epsg:3395')
        ds = generate_test_dataset(
            dims=dims, crs=crs1
        )
    
        proj = Reprojection(crs=crs2)
        reprojected = proj.apply(ds)
    
        # Check that a reprojected slice of the dataset is the same as
        # the slice of the reprojection of the entire dataset.
        slices = [
            {'band': 3},
            {'time': slice(1, 3)}
        ]
        for s in slices:
            xr_assert_equal(
                proj.apply(ds.isel(**s)),
>               reprojected.isel(**s)
            )
E           AssertionError: Left and right Dataset objects are not equal
E           
E           
E           Differing data variables:
E           L   C12__im  (time, extra, y, x) float64 -0.4385 0.295 0.5144 ... 0.0594 -0.1833
E           R   C12__im  (time, y, x, extra) float64 -0.4385 0.7736 ... -0.1302 -0.1833
E           L   C12__re  (time, extra, y, x) float64 0.5077 0.1089 0.2545 ... 0.6105 0.2276
E           R   C12__re  (time, y, x, extra) float64 0.5077 0.1572 0.1089 ... -0.51 0.2276
E           L   C22      (time, extra, y, x) float64 -0.1661 -1.155 ... -0.6713 -0.06515
E           R   C22      (time, y, x, extra) float64 -0.1661 -0.3903 ... 0.1816 -0.06515
E           L   C11      (time, extra, y, x) float64 -0.6673 0.6047 -0.325 ... 0.5696 0.1056
E           R   C11      (time, y, x, extra) float64 -0.6673 0.03727 ... 0.01081 0.1056

nd/tests/test_warp.py:535: AssertionError

Simplify get_transform(), get_bounds(), get_resolution(), and get_extent()

Is your feature request related to a problem? Please describe.
The following methods are not currently very consistent in what information is used to extract the corresponding parameter:

  • nd.warp.get_transform()
  • nd.warp.get_bounds()
  • nd.warp.get_extent()
  • nd.warp.get_resolution()

Describe the solution you'd like
The most reliable information to determine the transform etc. is probably the coordinate arrays and should be used even if there is relevant metadata present.

The methods may optionally raise a warning if the coordinate arrays don't seem to match the values specified in the metadata.

Create tests for `nd.vector.rasterize()`

Need to create tests for the nd.vector module, particularly nd.vector.rasterize().

  • Create a test shapefile with attributes
  • test correct rendering of polygons into raster
  • test correct handling of both categorical and numeric labels

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.