def handle(self, *agrs, **options): options['start'] = datetime.strptime(options['start'], '%Y-%m-%d') options['end'] = datetime.strptime(options['end'], '%Y-%m-%d') geometry = self.geometry_from_options(extent=options['extent'], geojson=options['geojson']) for non_ingested_uri in uris_from_args(options['i_files']): ds = DrifterDataset.objects.get_or_create(non_ingested_uri, geometry, **options)
def handle(self, *args, **options): for non_ingested_uri in uris_from_args(options['ascat_files']): self.stdout.write('Ingesting %s ...\n' % non_ingested_uri) ds, cr = Dataset.objects.get_or_create(non_ingested_uri, **options) if cr: self.stdout.write('Successfully added: %s\n' % non_ingested_uri) else: self.stdout.write('Was already added: %s\n' % non_ingested_uri)
def handle(self, *args, **options): #if not len(args)==1: # raise IOError('Please provide one filename only') for non_ingested_uri in uris_from_args(options['sar_files']): self.stdout.write('Ingesting %s ...\n' % non_ingested_uri) try: ds, cr = Dataset.objects.get_or_create(non_ingested_uri, **options) except GeolocationError: self.stdout.write('Geolocation error in: %s\n' % non_ingested_uri) continue if cr: self.stdout.write('Successfully added: %s\n' % non_ingested_uri) else: self.stdout.write('Was already added: %s\n' % non_ingested_uri)
def handle(self, *args, **options): if not len(options['files'])==2: raise IOError('Please provide two filenames for metadata and data') start = parse(options['start']) stop = parse(options['stop']) minlon = float(options['minlon']) maxlon = float(options['maxlon']) minlat = float(options['minlat']) maxlat = float(options['maxlat']) maxnum = eval(options['maxnum']) uris = uris_from_args([options['files'][0], options['files'][1]]) count = SVPDrifter.objects.add_svp_drifters(uris[0], uris[1], time_coverage_start=start, time_coverage_end=stop, minlat=minlat, maxlat=maxlat, minlon=minlon, maxlon=maxlon, maxnum=maxnum) print 'Added %d new drifter datasets'%count