Giter VIP home page Giter VIP logo

Comments (2)

virginiayung avatar virginiayung commented on June 18, 2024 1

These are the current steps I am taking to refactor the current worker script in the refactor_api branch and PR #13

  • Renaming current pansharpen function to calculate_landsat_pansharpen. This function handles:
  • reading, updating input meta data
  • writing the result of pansharpening (derived by _pansharpen_worker) into each window respectively via riomucho.
  • _pansharpen_worker function is the riomucho worker for pansharpening. It is responsible for:
    • Reading panchromatic band data, determines the datatype for the panchromatic band from meta data
    • Determining RGB window sizes (includes padding)
    • Determining affines for pan, RGB windows
    • Reading RGB data
    • Passing necessary arguments to the new pansharpen function to perform pansharpening
    • rescaling pansharpened array to destination datatype
  • new pansharpen is the pansharpening python API (data-in, data-out, no IO) that performs pansharpening operations:
    • Takes ndarrays (RGB bands, pan band), and arguments (Affine transforms) etc
    • Creates a mask of pixels where any channel is 0 (nodata)
    • Apply the mask to each of the RGB bands
    • Perform pansharpening using the specified algorithm. Default is Brovey.
    • Returns ndarray, 3D with shape == (3, panband_height, panband_width)

The biggest advantage for refactoring the current pansharpening script into a pure function, separating IO from array operations is so that we can easily write unit tests that specifically test for array operations:

def test_create_apply_mask(arr):
  .
  .
def test_upsample(masked_arr, pan.shape, pan.shape, rgb_affine, r_crs, pan_affine, dst_crs)
  .
  .
def test_Brovey(arr1, arr2, weight, dtype):
  .
  .
def test_rescale(arr):
  .
  .

cc @dnomadb @perrygeo @celoyd @mapbox/satellite

from rio-pansharpen.

virginiayung avatar virginiayung commented on June 18, 2024

🚢 in PR #13

from rio-pansharpen.

Related Issues (19)

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.