Comments (6)
Hey, can you post the input data so I can better see what you're trying to do?
from geowombat.
@jgrss Here's an example:
from geowombat.data import (
l8_224077_20200518_B2,
l8_224078_20200518_B2,
l8_224077_20200518_B3,
l8_224078_20200518_B3,
)
with gw.open([l8_224077_20200518_B2, l8_224077_20200518_B3], stack_dim="band") as src1:
with gw.open(
[l8_224078_20200518_B2, l8_224078_20200518_B3], stack_dim="band"
) as src2:
with gw.open([src1, src2], mosaic=True) as src:
print(src)
from geowombat.
I think you can do the first approach if you set the overall bounds.
import dask.array as da
from geowombat.backends.rasterio_ import get_file_bounds
# Get the union of all bounding boxes
# Note that you probably want to pass `crs` in this method.
bounds = get_file_bounds([l8_224077_20200518_B2, l8_224078_20200518_B2], bounds_by="union", return_bounds=True)
with gw.config.update(ref_bounds=bounds):
with gw.open([l8_224077_20200518_B2, l8_224077_20200518_B3], band_names=[1, 2], stack_dim="band") as src1:
with gw.open([l8_224078_20200518_B2, l8_224078_20200518_B3], band_names=[1, 2], stack_dim="band") as src2:
darray = da.maximum(src1, src2)
print(darray)
from geowombat.
As for the VRT approach, that looks like it could work. However, there is a bug when passing the default integer EPSG -- gdal.BuildVRTOptions
outputSRS
does not like EPSG integers, so you could try setting the DataArray
CRS attribute as a WKT string like src1.attrs["crs"] = src1.gw.crs_to_pyproj.to_wkt()
.
from geowombat.
Follow-up on the first option. In the case of more than two arrays, you might want to use numpy.
import numpy as np
with gw.config.update(ref_bounds=bounds):
with gw.open([l8_224077_20200518_B2, l8_224077_20200518_B3], band_names=[1, 2], stack_dim="band") as src1:
with gw.open([l8_224078_20200518_B2, l8_224078_20200518_B3], band_names=[1, 2], stack_dim="band") as src2:
darray = np.maximum.reduce(src1, src2, src3, src4, ...)
print(darray)
from geowombat.
ok thanks I will play around with it. Looks like the VRT option is still throwing the error.
from geowombat.
Related Issues (20)
- Failed to Install Geowombat on pip and conda HOT 12
- Requirement differences between package & conda-forge HOT 6
- Coordinating efforts on potential new geospatial Xarray accessor HOT 2
- Regression capability in geowombat HOT 3
- ARM Installation Issues HOT 9
- Apply interpolation HOT 4
- Stac import HOT 2
- series.apply big tiff / bad block
- EVI equation is wrong HOT 2
- Support for pyproj 3.4.1? HOT 8
- Slow extract HOT 2
- mosaic bounds HOT 4
- fit_predict
- writing with Bigtiff HOT 2
- [] in open trigger stacking
- polygon_to_array returns shorter y dimension than source rasters HOT 26
- band names HOT 1
- Unable to import geowombat HOT 1
- Mosaic Fails with nan nodata HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geowombat.