def add(ctx, identifier, name, country, wmo_region, url, email, ftp_username, geometry): """Add a contributor""" geom_tokens = geometry.split(',') contributor_ = { 'identifier': identifier, 'name': name, 'country_id': country, 'wmo_region': wmo_region, 'url': url, 'email': email, 'ftp_username': ftp_username, 'x': geom_tokens[0], 'y': geom_tokens[1] } add_metadata(Contributor, contributor_) click.echo('Contributor {} added'.format(name))
def add(ctx, identifier, name, contributor, gaw_id, country, wmo_region, start_date, end_date, geometry): """Add a station""" geom_tokens = geometry.split(',') station_ = { 'identifier': identifier, 'name': name, 'contributor_id': contributor, 'gaw_id': gaw_id, 'country_id': country, 'wmo_region': wmo_region, 'active_start_date': start_date, 'active_end_date': end_date, 'x': geom_tokens[0], 'y': geom_tokens[1], 'z': geom_tokens[2] } add_metadata(Station, station_) click.echo('Station {} added'.format(name))
def add(ctx, identifier, name, type_, gaw_id, country, wmo_region, start_date, end_date, geometry): """Add a station""" geom_tokens = geometry.split(',') station_ = { 'station_id': identifier, 'station_name': name, 'station_type': type_, 'gaw_id': gaw_id, 'country_id': country, 'wmo_region_id': wmo_region, 'start_date': start_date, 'end_date': end_date, 'x': geom_tokens[1], 'y': geom_tokens[0], 'z': geom_tokens[2] } add_metadata(Station, station_, save_to_registry, save_to_index) click.echo('Station {} added'.format(identifier))
def add(ctx, identifier, path): """Add a news notification""" with open(path) as news_file: notification = yaml.safe_load(news_file) notification['published'] = datetime.now() if identifier: notification['identifier'] = identifier added = add_metadata(Notification, notification, save_to_registry, save_to_index) click.echo('Notification {} added'.format(added.notification_id))
def add(ctx, station, contributor, start_date, end_date): """Add a deployment""" start_date = start_date.date() if end_date is not None: end_date = end_date.date() deployment_ = { 'station_id': station, 'contributor_id': contributor, 'start_date': start_date, 'end_date': end_date } result = add_metadata(Deployment, deployment_, save_to_registry, save_to_index) click.echo('Deployment {} added'.format(result.deployment_id))
def add(ctx, name, acronym, country, project, wmo_region, url, email, ftp_username, geometry): """Add a contributor""" geom_tokens = geometry.split(',') contributor_ = { 'name': name, 'acronym': acronym, 'country_id': country, 'project_id': project, 'wmo_region_id': wmo_region, 'url': url, 'email': email, 'ftp_username': ftp_username, 'x': geom_tokens[1], 'y': geom_tokens[0] } result = add_metadata(Contributor, contributor_, save_to_registry, save_to_index) click.echo('Contributor {} added'.format(result.contributor_id))
def add(ctx, station, dataset, contributor, name, model, serial, geometry): """Add an instrument""" geom_tokens = geometry.split(',') if len(geom_tokens) == 2: geom_tokens.append(None) instrument_ = { 'station_id': station, 'dataset_id': dataset, 'contributor_id': contributor, 'name': name, 'model': model, 'serial': serial, 'start_date': datetime.now(), 'x': float(geom_tokens[1]), 'y': float(geom_tokens[0]), 'z': float(geom_tokens[2]) } result = add_metadata(Instrument, instrument_, save_to_registry, save_to_index) click.echo('Instrument {} added'.format(result.instrument_id))