11 votes

Mask xarray dataset using a shapefile

Masking NetCDF time series data from shapefile using Python You can use rioxarray. Here is an example: https://corteva.github.io/rioxarray/stable/examples/clip_geom.html import rioxarray import ...
snowman2's user avatar
  • 7,341
10 votes
Accepted

Mask xarray dataset using a shapefile

You can to use the rasterio.features.geometry_mask function to do this: ShapeMask = rasterio.features.geometry_mask(sf.iloc[0], out_shape=(len(ndvi.y), len(ndvi....
Claire K's user avatar
  • 116
5 votes

Open Data Cube how to continue after the creation of the database?

I'm assuming that you have set the datacube up (test that with datacube system check). Otherwise, get started with the following doc, cross-checking whether you've completed all the steps mentioned in ...
Aarif Shaikh's user avatar
5 votes
Accepted

Finding all dates of particular dataset in Open Data Cube

If you only need the list of dates, you can use index.search_returning(), which is much faster than a normal search as it doesn't need to pull the entire dataset back. You give it the list of fields ...
jeremyh's user avatar
  • 246
4 votes
Accepted

TypeError: tuple indices must be integers or slices, not str after ingested data into the open data cube

I'm not certain what the error is just yet. I have this (the CEOS wrapper for pyCCD) working on my machine and can relay details I think are relevant to pyccd. Data Landsat data should be ...
Conic's user avatar
  • 166
4 votes

NameError in Machine learning with Open Data Cube notebook code

I am an author of the notebook and the classification tools library, I've fixed the issue you found. It was a missing import triggered in a particular edge case, in this instance some of your training ...
Sean C's user avatar
  • 41
4 votes
Accepted

How to align X and Y pixel values to a boundary using the Open Data Cube

To follow up on @huite-bootsma's comment, I would try plotting your 30 x 30 m gridded vegetation data over the data you've loaded from Open Data Cube. My feeling is that the pixel edges should line up ...
Robbi Bishop-Taylor's user avatar
4 votes
Accepted

How to filter Open Data Cube satellite data by cloud coverage similar to the Sentinel API?

Yes, once you have Sentinel-2 data indexed into an Open Data Cube instance you can use some existing tools to filter by cloud percentages: for example, the load_ard function from dea-tools allows you ...
Robbi Bishop-Taylor's user avatar
4 votes
Accepted

Load Landsat data from specific months using the Open Data Cube

August 2021 update: As of version v1.84, open-data-cube itself now supports passing directly filtering data before loading it by passing a predicate/filter function to datacube.load()'s new ...
Robbi Bishop-Taylor's user avatar
4 votes

Indexing USGS Landsat Collection 2 Level 2 datasets into Open Data Cube

You can now index USGS data into the Open Data Cube using the command line tool STAC API to DC There are some notes on how to achieve indexing USGS Collection 2 data here. A brief howto is as follows: ...
Alex Leith's user avatar
  • 13.5k
4 votes

Mask xarray dataset using a shapefile

You can try using Digital Earth Australia's xr_rasterize function to convert your geopandas geodataframe into an xarray object, and then use xarray's .where() method to mask you're array. e.g. mask ...
cbur's user avatar
  • 61
4 votes
Accepted

What is the minimum `metadata` specification for the Open Data Cube?

There is a good example in documentation https://datacube-core.readthedocs.io/en/stable/ops/dataset_documents.html explaining which is required and which is optional to create a dataset yaml file.
hrampur's user avatar
  • 56
4 votes

Is there an Open Data Cube (ODC) example/documentation on indexing data residing on Google Cloud

Google Cloud Storage support was only added to datacube-core recently and hasn't been officially released yet, so the documentation for this capability needs some work. In the mean time I'll add the ...
Tom Butler's user avatar
4 votes

Datacube ODC environment setup

This notebook is designed to be run in the Digital Earth Australia Sandbox. The idea is that the Sandbox is a space where an ODC environment is already set up, and data is already present in the ...
Caitlin Adams's user avatar
3 votes
Accepted

Open Jupyter Notebook with Open Data Cube in docker

There's an example configuration of the Open Data Cube and Docker available called "Cube in a Box". You should be able to get something up using just Docker Compose, as shown below, but the above ...
Alex Leith's user avatar
  • 13.5k
3 votes

Finding all dates of particular dataset in Open Data Cube

If what I'm hearing is that you'd like to know all the dates that a datacube product has datasets for, I don't think there's a built-in function. The naive way to do it is to write something like: ...
Alex Leith's user avatar
  • 13.5k
3 votes
Accepted

Data indexing problem with Open Data Cube

When you use Postgres, you need to terminate a line with ;. If you do that, you'll get an error message because the datacube command is not a Postgres command. To run Datacube, you do it just from the ...
Alex Leith's user avatar
  • 13.5k
3 votes
Accepted

Create STAC catalog file for my s3 bucket

Great question. The easiest way to do this is using RIO STAC, which was developed by the magnificent Vincent Sarago. I use it programmatically (from Python). Make sure you enable the Projection ...
Alex Leith's user avatar
  • 13.5k
3 votes
Accepted

OSError: Failed to list error in Open Data Cube

I think there was a minor issue with the docs, which I have fixed. Try indexing from the Element 84-managed bucket in us-west-2, like this: s3-to-dc --stac --no-sign-request \ "s3://sentinel-cogs/...
Alex Leith's user avatar
  • 13.5k
2 votes

Installing command line tools for Open Data Cube?

Check out the section "Manual installation (Fallback)" in the docs. There is nothing wrong with your conda environment...keep it. For some reason your system does not recognize the command. Activate ...
Jürgen Zornig's user avatar
2 votes

Why is there no XML-File with metadata when I download Landsat 8 data on USGS?

You can find the XML as a separated file if you use Landsat ARD (if you wonder why I mentioned ARD it's because of the file name usgs_ls_ard_prepare.py). ARD only covers the conterminous United States ...
ThomasG77's user avatar
  • 30.8k
2 votes

How to index and load a time-stacked NetCDF file with Open Data Cube?

An explicit time index can be achieved by appending a fragment (#part=<index>) to the uri in the path attribute of the metadata document. It starts from 0. The uri also needs to start with file:/...
martin's user avatar
  • 71
2 votes

How should ODC databases be restored and snapshot in Docker?

I don't think you should store application state in a Docker container. And DB data kind of fits this. There's a post here, which says it's not best practice. using a Dockerfile allows you to ...
Alex Leith's user avatar
  • 13.5k
2 votes

Getting the right version of datacube-explorer

That page does have the latest stable version. Extract it to a directory, enter the directory, and pip install . If you're seeing an older version after running those steps, perhaps try uninstalling ...
jeremyh's user avatar
  • 246
2 votes
Accepted

Not able to plot Open Data Cube dataset image

I think this might be able to be solved just by running plt.show() after calling the .plot() method. Another issue I have sometimes encountered is importing matplotlib and then plotting something in ...
JackLidge's user avatar
  • 338
2 votes

Partial data loading from the Open Data Cube is not working

As far as I can tell, your query is set up correctly - it's entirely possible to query by geographic (lat-lon) coords and return data in a different coordinate reference system (e.g. EPSG:3857 with ...
Robbi Bishop-Taylor's user avatar
2 votes

Partial data loading from the Open Data Cube is not working

I managed to fix this issue. The query was absolutely fine; however, the preparation script I have used from the data cube Github repository needed a tweak. FYI, I used the sen2cor_prepare.py to index ...
prpp2021's user avatar
  • 115
2 votes

Unable to load the data product of Open Data Cube dataset image

Usually if you get an empty return, there is no data over your area of interest. Try loading a dataset searching by extents, like this: datasets = dc.find_datasets(product='AWiFS_21May19', limit=1) ...
Alex Leith's user avatar
  • 13.5k
2 votes
Accepted

Data indexing from DEAfrica STAC is not working

It's probably because the default STAC api, the stac-to-dc tool pointing to is from https://earth-search.aws.element84.com/v0/ and it doesn't have a STAC collection called 's1_rtc'. If you change your ...
Nilster's user avatar
  • 86

Only top scored, non community-wiki answers of a minimum length are eligible