Commit 41394416 authored by PIOLLE's avatar PIOLLE

fix for some invalid geometries

parent 7b6f2bd1
......@@ -101,11 +101,11 @@ def create_miniprods_filter(dataset, collection, site, start, stop):
""" """
filters = []
if dataset is not None:
filters.append({'term': {'felyx_dataset_name': dataset}})
filters.append({'term': {'felyx_dataset_name': dataset[0]}})
if collection is not None:
filters.append({'term': {'felyx_site_collection_name': collection}})
filters.append({'term': {'felyx_site_collection_name': collection[0]}})
if site is not None:
filters.append({'term': {'felyx_site_identifier': site}})
filters.append({'term': {'felyx_site_identifier': site[0]}})
if None not in [start, stop]:
# Validate time format
try:
......
......@@ -712,17 +712,21 @@ class SourceFile(object):
lat_boundary = numpy.array(
(lat_min, lat_min, lat_max, lat_max, lat_min)
)
shape = GeographicPolygon(
[(lon_boundary,
lat_boundary,
(lons[int(len(lons)/2)], lats[int(len(lats)/2)]))]
)
try:
shape = GeographicPolygon(
[(lon_boundary,
lat_boundary,
(lons[int(len(lons)/2)], lats[int(len(lats)/2)]))]
)
if boundary_shape is None:
boundary_shape = self.data_shape
if boundary_shape is None:
boundary_shape = self.data_shape
if (boundary_shape.intersects(shape)):
result[site] = shape
if (boundary_shape.intersects(shape)):
result[site] = shape
except ValueError as err:
print(err)
continue
# if boundary_shape.use_adjusted or shape.use_adjusted:
# if not boundary_shape.adjusted_shape.disjoint(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment