Skip to content

Commit

Permalink
Merge branch 'ga/milestone1' of https://github.com/data-cube/agdc-v2
Browse files Browse the repository at this point in the history
…into ga/milestone1
  • Loading branch information
andrewdhicks committed Dec 16, 2015
2 parents b029cc2 + 856b11b commit 814abe6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions datacube/storage/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,17 @@ def __init__(self, dataset, measurement_id):
self.projection = None
self.nodata = None
self.format = dataset.format
if self.format == 'NetCDF4':
self._band_id = 1 # TODO: this magically works for H8 netcdf

@contextmanager
def open(self):
try:
with rasterio.open(self._filename) as src:
self.transform = src.affine
self.projection = src.crs
self.nodata = src.nodatavals[0] or (0 if self.format == 'JPEG200' else None) # TODO: sentinel 2 hack
yield rasterio.band(src, self._band_id) # TODO: this magically works for H8 netcdf
self.nodata = src.nodatavals[0] or (0 if self.format == 'JPEG2000' else None) # TODO: sentinel 2 hack
yield rasterio.band(src, self._band_id)
finally:
src.close()

Expand Down
2 changes: 1 addition & 1 deletion docs/config_samples/himawari_8/1km_bands_storage_type.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

name: 1km_bands
description: 1km metre, 10 degree EO NetCDF storage unit.
description: 1km, 10 degree EO NetCDF storage unit.
driver: NetCDF CF

projection:
Expand Down
6 changes: 3 additions & 3 deletions docs/config_samples/sentinel_2/s2_msi_l1c_mapping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ match:
storage:
- name: 10m_bands
location_name: eotiles
file_path_template: '{platform[code]}_{instrument[name]}_{lons[0]}_{lats[0]}_{extent[center_dt]:%Y-%m-%dT%H-%M-%S.%f}.nc'
file_path_template: '{platform[code]}_{instrument[name]}_10m_{lons[0]}_{lats[0]}_{extent[center_dt]:%Y-%m-%dT%H-%M-%S.%f}.nc'
global_attributes:
title: Experimental Data files From the Australian Geoscience Data Cube - DO NOT USE
summary: These files are experimental, short lived, and the format will change.
Expand Down Expand Up @@ -44,7 +44,7 @@ storage:
varname: band_08
- name: 20m_bands
location_name: eotiles
file_path_template: '{platform[code]}_{instrument[name]}_{lons[0]}_{lats[0]}_{extent[center_dt]:%Y-%m-%dT%H-%M-%S.%f}.nc'
file_path_template: '{platform[code]}_{instrument[name]}_20m_{lons[0]}_{lats[0]}_{extent[center_dt]:%Y-%m-%dT%H-%M-%S.%f}.nc'
global_attributes:
title: Experimental Data files From the Australian Geoscience Data Cube - DO NOT USE
summary: These files are experimental, short lived, and the format will change.
Expand Down Expand Up @@ -84,7 +84,7 @@ storage:
varname: band_8A
- name: 60m_bands
location_name: eotiles
file_path_template: '{platform[code]}_{instrument[name]}_{lons[0]}_{lats[0]}_{extent[center_dt]:%Y-%m-%dT%H-%M-%S.%f}.nc'
file_path_template: '{platform[code]}_{instrument[name]}_60m_{lons[0]}_{lats[0]}_{extent[center_dt]:%Y-%m-%dT%H-%M-%S.%f}.nc'
global_attributes:
title: Experimental Data files From the Australian Geoscience Data Cube - DO NOT USE
summary: These files are experimental, short lived, and the format will change.
Expand Down

0 comments on commit 814abe6

Please sign in to comment.