def create_amphora(params,param_name,username,password): # Create new amphora for data credentials = Credentials(username=username, password=password) client = AmphoraDataRepositoryClient(credentials) ## Create Amphora sep=" " amphora_description=sep.join(["Simulation of Pandemic code from Microprediction \n Parameter set is for",param_name," \n \ N =",str(float(params['geometry']['n']))," \n I =",str(float(params['geometry']['i']))," \n \ R =",str(float(params['geometry']['r']))," \n B =",str(float(params['geometry']['b']))," \n \ H =",str(float(params['geometry']['h']))," \n C =",str(float(params['geometry']['c']))," \n \ S =",str(float(params['geometry']['s']))," \n E =",str(float(params['geometry']['e']))," \n \ P =",str(float(params['geometry']['p']))," \n T =",str(float(params['motion']['t']))," \n \ K =",str(float(params['motion']['k']))," \n W =",str(float(params['motion']['w']))," \n \ VI =",str(float(params['health']['vi']))," \n IS =",str(float(params['health']['is']))," \n \ IP =",str(float(params['health']['ip']))," \n SP =",str(float(params['health']['sp']))," \n \ IR =",str(float(params['health']['ir']))," \n ID =",str(float(params['health']['id']))," \n \ SR =",str(float(params['health']['sr']))," \n SD =",str(float(params['health']['sd']))," \n \ PD =",str(float(params['health']['pd']))," \n PR =",str(float(params['health']['pr']))]) amphora_tnc="Creative_Commons_0" amphora_name=sep.join(["Ensemble simulation of Microprediction Pandemic for",param_name]) labels=['Covid,simulation,timeseries',param_name] amphora = client.create_amphora(name = amphora_name, price = 0, description = amphora_description, terms_and_conditions_id = amphora_tnc, labels=labels) amphora_id = amphora.amphora_id # Create signals amphora.create_signal("vulnerable", attributes={"units":"#"}) amphora.create_signal("infected", attributes={"units":"#"}) amphora.create_signal("symptomatic", attributes={"units":"#"}) amphora.create_signal("positive", attributes={"units":"#"}) amphora.create_signal("recovered", attributes={"units":"#"}) amphora.create_signal("deceased", attributes={"units":"#"}) return amphora_id
def create_or_update_amphorae(client: AmphoraDataRepositoryClient, amphora_map, location_info): new_map = dict() try: # client=amphora_client.ApiClient(configuration) # amphora_api = amphora_client.AmphoraeApi(client) for key in amphora_map: id = amphora_map[key] if (id == None): # we have to create an Amphora wzloc = location_info[key] locname = wzloc['name'] print(f'Creating new Amphora for location {locname}') # create the details of the Amphora name = 'Weather: ' + wzloc['name'] + ' (' + wzloc['state'] + ')' desc = 'WeatherZone data, from ' + wzloc[ 'name'] + '. WeatherZone code: ' + wzloc[ 'code'] + ', PostCode: ' + wzloc['postcode'] labels = 'Weather,forecast,timeseries' ts_cs_id = 'Weatherzone_Forecast' amphora = client.create_amphora( name, desc, price=2, labels=labels, lat=wzloc['latitude'], lon=wzloc['longitude'], terms_and_conditions_id=ts_cs_id) # now create the signals print("Creating Signals") for s in signals(): amphora.create_signal(s._property, s.value_type, s.attributes) new_map[key] = amphora.id else: amphora = client.get_amphora(id) time.sleep(0.2) # wait a bit to prevent hitting the rate limit print(f'Using existing amphora: {amphora.metadata.name}') new_map[key] = id except Exception as e: print("Error Create or update amphorae: %s\n" % e) raise e return new_map
# Create Amphora # Define metadata for Amphora sep = " " amphora_description = "This is an Amphora for a tutorial on how to make Amphoras" amphora_tnc = "Creative_Commons_4p0" amphora_name = "Tutorial: How to make and upload an Amphora" amphora_labels = ["tutorial,timeseries"] amphora_price = 0 # Monthly price of Amphora amphora_lat = -27.45714 amphora_lon = 153.07106 ## Create an Amphora amphora = client.create_amphora(name=amphora_name, lat=amphora_lat, lon=amphora_lon, price=amphora_price, description=amphora_description, terms_and_conditions_id=amphora_tnc, labels=amphora_labels) # Save Amphora ID for later File_object = open("Amphora_id.txt", "w") File_object.write(amphora.amphora_id) File_object.close() # Now create signal amphora.create_signal("timeProduct", attributes={"units": "HMS"}) signalStore = [] signalStore.append({"t": time_now, "timeProduct": time_prod}) # Push signal
amphora_api = a10a.AmphoraeApi(client.apiClient) importCsv("country_index.csv") parameters = ["beta"] ## Create Amphora for beta amphora_description = "Beta parameter data for Covid 19 for Australia, New Zealand, Great Britain, Canada, USA, China, Indonesia and India. \n beta is from SIRD model \n dS/dt = - beta * S * I \n dI/dt = beta * S * I - alpha * I - gamma * I \n dR/dt = alpha * I \n dD/dt = gamma * I" amphora_tnc = "Creative_Commons_0" amphora_name = "Beta parameter for 8 countries" labels = ['Covid, actuals, timeseries'] ## Create an Amphora amphora = client.create_amphora(name=amphora_name, price=0, description=amphora_description, terms_and_conditions_id=amphora_tnc, labels=labels) amphora_id = amphora.amphora_id amphora_api = a10a.AmphoraeApi(client.apiClient) T = 25 for i in range(len(country_stor)): sep = "" # Pull beta signal ## Get the data ts_api = a10a.TimeSeriesApi(client.apiClient) time_range = a10a.DateTimeRange(_from=datetime.utcnow() + timedelta(days=-T), to=datetime.utcnow() + timedelta(days=-5)) variables = { "beta":
import os from amphora.client import AmphoraDataRepositoryClient, Credentials # provide your login credentials credentials = Credentials(username=os.environ['username'], password=os.environ['password']) # create a client for interacting with the public Amphora Data Repository client = AmphoraDataRepositoryClient(credentials) # create an amphora amphora = client.create_amphora("My New Data Store", "This is a description of my new Amphora", lat=20, lon=20) print(amphora.metadata) # update the amphora amphora.update(price=10, labels=["custom", "labels"]) # delete the amphora amphora.delete()
import os from amphora.client import AmphoraDataRepositoryClient, Credentials NEW_FILE_NAME = "a_new_file.jpg" # provide your login credentials credentials = Credentials(username=os.environ['username'], password=os.environ['password'], host="https://app.amphoradata.com") # create a client for interacting with the public Amphora Data Repository client = AmphoraDataRepositoryClient(credentials) # get a reference to an Amphora amphora = client.create_amphora( name="Various Dogs", description="Contains labelled images of various types of dog breeds.") # pushes the dog images to the Amphora Data Repository, with attributes amphora.push_file("data/dogs/chihuahua.jpg", attributes={ 'breed': 'chihuahua', 'size': 'small', 'primaryColour': 'brown' }) amphora.push_file("data/dogs/german-shepherd.jpg", attributes={ 'breed': 'german-shepherd', 'size': 'large', 'primaryColour': 'brown' }) amphora.push_file("data/dogs/golden-retriever.jpg",
def create_amphora(client: AmphoraDataRepositoryClient, site: BOMSite)-> Amphora: return client.create_amphora(f'Weather Observations: {site.name}, {site.state}', des(site), price=PRICE, lat=site.lat, lon=site.lon, terms_and_conditions_id=TERMS_ID, labels=labels )
# Import Amphora modules from amphora.client import AmphoraDataRepositoryClient, Credentials # Import non-Amphora modules import os # Login to amphoradata.com credentials = Credentials(username=os.getenv('username'), password=os.getenv('password')) client = AmphoraDataRepositoryClient(credentials) # Set metadata for Amphora name = "Amphora_Name" #Name the amphora as string description = "Amphora_Description" #Describe the amphora as string price = 0 #Monthly price as float labels = ["Label_1", "Label_2", "Label_3"] #List of 2-5 one word strings lat = 0.0 #Enter latitude as float lon = 0.0 #Enter longitude as float # Create Amphora amphora = client.create_amphora(name=name, description=description, labels=labels, price=price, lat=lat, lon=lon)
import os from amphora.client import AmphoraDataRepositoryClient, Credentials # provide your login credentials credentials = Credentials(username=os.environ['username'], password=os.environ['password']) # create a client for interacting with the public Amphora Data Repository client = AmphoraDataRepositoryClient(credentials) # get a reference to an Amphora amphora = client.create_amphora(name="Access Controls Example", description="Used for showing Access Controls") amphora.share_with( "*****@*****.**") # the username of the person to share with