Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def crawl_and_ingest(url, **options):
# Create Dataset from OPeNDAP url - this is necessary to get all metadata
gds, cr = NansatDataset.objects.get_or_create(url, uri_service_name=name,
uri_service_type=service)
except (IOError, AttributeError) as e:
except (IOError, AttributeError, ValueError) as e:
# warnings.warn(e.message)
continue
if cr:
Expand Down
20 changes: 15 additions & 5 deletions geospaas/nansat_ingestor/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,22 @@ def get_or_create(self,
# get metadata from Nansat and get objects from vocabularies
n_metadata = n.get_metadata()

entry_id = n_metadata.get('entry_id', None)
entry_id = n_metadata.get('entry_id', n_metadata.get('id', None))
# set compulsory metadata (source)
platform, _ = Platform.objects.get_or_create(
json.loads(n_metadata['platform']))
instrument, _ = Instrument.objects.get_or_create(
json.loads(n_metadata['instrument']))
pp = n_metadata['platform']
try:
pp_dict = json.loads(pp)
except json.JSONDecodeError:
pp_entry = [elem.strip() for elem in pp.split('>')]
pp_dict = pti.get_gcmd_platform(pp_entry[-1])
platform, _ = Platform.objects.get_or_create(pp_dict)
ii = n_metadata['instrument']
try:
ii_dict = json.loads(ii)
except json.JSONDecodeError:
ii_entry = [elem.strip() for elem in ii.split('>')]
ii_dict = pti.get_gcmd_instrument(ii_entry[-1])
instrument, _ = Instrument.objects.get_or_create(ii_dict)
specs = n_metadata.get('specs', '')
source, _ = Source.objects.get_or_create(platform=platform,
instrument=instrument,
Expand Down