Skip to content

Commit

Permalink
Merge pull request #254 from opendatacube/various_fixes
Browse files Browse the repository at this point in the history
Various fixes
  • Loading branch information
SpacemanPaul authored Apr 29, 2020
2 parents bbef3f7 + 4a7e9a8 commit ade0bfe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
11 changes: 8 additions & 3 deletions datacube_ows/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,10 @@ def feature_info(args):
pixel_ds = td.isel(**isel_kwargs)

# Get accurate timestamp from dataset
date_info["time"] = dataset_center_time(ds).strftime("%Y-%m-%d %H:%M:%S UTC")

if params.product.is_raw_time_res:
date_info["time"] = dataset_center_time(ds).strftime("%Y-%m-%d %H:%M:%S UTC")
else:
date_info["time"] = ds.time.begin.strftime("%Y-%m-%d")
# Collect raw band values for pixel and derived bands from styles
date_info["bands"] = _make_band_dict(params.product, pixel_ds, stacker.needed_bands())
derived_band_dict = _make_derived_band_dict(pixel_ds, params.product.style_index)
Expand All @@ -590,11 +592,14 @@ def feature_info(args):
if not params.product.pq_ignore_time:
pq_datasets = collapse_datasets_to_times(pq_datasets, params.times, tz)
pq_data = stacker.data(pq_datasets, mask=True)
feature_json["flags"] = []
# feature_json["flags"] = []
for dt in pq_data.time.values:
pqd =pq_data.sel(time=dt)
date_info = fi_date_index.get(dt)
if not date_info:
if "flags" not in date_info:
date_info["flags"] = {}
else:
date_info = {"flags": {}}
feature_json["data"].append(date_info)
pq_pixel_ds = pqd.isel(**isel_kwargs)
Expand Down
12 changes: 7 additions & 5 deletions datacube_ows/ows_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def __init__(self, cfg, global_cfg, dc, parent_layer=None):
# TODO: sub-ranges
self.band_idx = BandIndex(self.product, cfg.get("bands"), dc)
try:
self.parse_resource_limits(cfg.get("resource_limits", {"wms": {}, "wcs": {}}))
self.parse_resource_limits(cfg.get("resource_limits", {}))
except KeyError:
raise ConfigException("Missing required config items in resource limits for layer %s" % self.name)
try:
Expand Down Expand Up @@ -368,10 +368,12 @@ def __init__(self, cfg, global_cfg, dc, parent_layer=None):
self.global_cfg.native_product_index[self.product_name] = self

def parse_resource_limits(self, cfg):
self.zoom_fill = cfg["wms"].get("zoomed_out_fill_colour", [150, 180, 200, 160])
self.min_zoom = cfg["wms"].get("min_zoom_factor", 300.0)
self.max_datasets_wms = cfg["wms"].get("max_datasets", 0)
self.max_datasets_wcs = cfg["wcs"].get("max_datasets", 0)
wms_cfg = cfg.get("wms", {})
wcs_cfg = cfg.get("wcs", {})
self.zoom_fill = wms_cfg.get("zoomed_out_fill_colour", [150, 180, 200, 160])
self.min_zoom = wms_cfg.get("min_zoom_factor", 300.0)
self.max_datasets_wms = wms_cfg.get("max_datasets", 0)
self.max_datasets_wcs = wcs_cfg.get("max_datasets", 0)

def parse_image_processing(self, cfg):
emf_cfg = cfg["extent_mask_func"]
Expand Down

0 comments on commit ade0bfe

Please sign in to comment.