Comments (5)
See the series class here for more details.
from geowombat.
Custom classes must have the following structure:
class Custom(gw.TimeModule):
def __init__(self):
super(Custom, self).__init__()
def calculate(self, array):
"""
Args:
array: JAX DeviceArray shaped [time x bands x rows x columns]
"""
# The returned array should have dimensions [output band count x rows x columns], where
res = <>
return res
Override the output data type, band count, and compression
class Custom(gw.TimeModule):
def __init__(self):
super(Custom, self).__init__()
self.dtype = 'uint16'
self.count = 2
self.compress = 'lzw'
def calculate(self, array):
"""
Args:
array: JAX DeviceArray shaped [time x bands x rows x columns]
"""
# If the array is shaped [20 x 1 x 100 x 100]
res = array.mean(axis=0).squeeze()
return res
Using the band dictionary
import geowombat as gw
import jax.numpy as jnp
class Custom(gw.TimeModule):
def __init__(self):
super(Custom, self).__init__()
def calculate(self, array):
"""
Args:
array: JAX DeviceArray shaped [time x bands x rows x columns]
"""
s1 = (slice(0, None), slice(band_dict['red'], band_dict['red']+1), slice(0, None), slice(0, None))
s2 = (slice(0, None), slice(band_dict['nir'], band_dict['nir']+1), slice(0, None), slice(0, None))
ndvi = (array[s1] - array[s2]) / (array[s1] + array[s2])
# Mean NDVI over time
res = jnp.nanmean(ndvi, axis=0).squeeze()
return res
with gw.series([...], band_names=['red', 'nir']) as src:
src.apply(Custom(), 'outfile.tif', bands=[3, 4])
from geowombat.
I created a page for time series on GPUs here.
from geowombat.
from geowombat.
I will close this as this is now implemented. However, feel free to reopen.
from geowombat.
Related Issues (20)
- ML DataArray HOT 13
- Predicted .tif file assigns a class to zero HOT 43
- Extra install examples fail; coreg extra builds unwanted GDAL version HOT 3
- config issue? HOT 11
- ml install HOT 2
- Ubuntu 22.4 & conda HOT 3
- AttributeError: type object 'threadpool_limits' has no attribute 'wrap' HOT 5
- Newer versions (> 1.2.0) do not work with Intel OpenMP installed HOT 15
- `python setup.py sdist` fails to find metadata HOT 4
- Resample leaves no data blocks into Sentinel2 image HOT 2
- geowombat save functionality not working HOT 15
- typo in mosaic min option HOT 3
- to_raster 'compress' functionality 'FileExistsError:' HOT 4
- Problem installing gewombat from git clone HOT 4
- conda-forge fail HOT 1
- Array clip failure HOT 2
- Masking with reproject HOT 1
- Google SEO HOT 8
- DOCS Index
- conda-forge issues HOT 13
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.