Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use geoutils functionality #4

Open
bpurinton opened this issue May 22, 2024 · 0 comments
Open

Use geoutils functionality #4

bpurinton opened this issue May 22, 2024 · 0 comments
Labels

Comments

@bpurinton
Copy link
Contributor

e.g. stack_rasters could be useful for computing difference maps. For example, as of now, I've done things like:

from pygeotools.lib import iolib, warplib
# ...
def compute_difference(self, second_fn, outdir=None):
      print(f"Computing difference map between:\n\n{self.fn}\n\nand\n\n{second_fn}")
      fn_list = [self.fn, second_fn]
      outdir = os.path.dirname(os.path.abspath(self.fn))

      outprefix = (
          os.path.splitext(os.path.split(self.fn)[1])[0]
          + "_"
          + os.path.splitext(os.path.split(second_fn)[1])[0]
      )

      ds_list = warplib.memwarp_multi_fn(
          fn_list, extent="intersection", res="max", t_srs="first", r="cubic"
      )
      r1_ds = ds_list[0]
      r2_ds = ds_list[1]
      r1 = iolib.ds_getma(r1_ds, 1)
      r2 = iolib.ds_getma(r2_ds, 1)
      diff = r2 - r1
      dst_fn = os.path.join(outdir, outprefix + "_diff.tif")
      iolib.writeGTiff(diff, dst_fn, r1_ds, ndv=-9999)
      return diff

Those iolib and warplib modules (or just the specific functions themselves) could be replaced / integrated / used to improve geoutils modules and functions.

It seems that the geoutils package is in very active development / improvement, considering its tight integration with xDEM.

I think using some of the utilities in those packages in this repository (soon to be package, after #3 is merged), could lead to feedback that improves all packages involved with added features.

There is a lot of great and useful things in dgtools, pygeotools, etc. that can be integrated into those other packages. And those other packages have tests and dedicated maintainers with many people using the packages, so we could be more confident of their long-term stability and wider usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant