def loadGliders(loader, stride=1): ''' Crawl the IOOS Glider TDS for OPeNDAP links of Time aggregated files and load into STOQS ''' c = Crawl("http://tds.gliders.ioos.us/thredds/catalog.xml", select=[".*_Time$"]) urls = [ s.get("url") for d in c.datasets for s in d.services if s.get("service").lower() == "opendap" ] colors = loader.colors.values() for url in urls: aName = url.split('/')[-1].split('.')[0] pName = aName.replace('_Time', '') if pName.find('-') != -1: logger.warn( "Replacing '-' characters in platform name %s with '_'s", pName) pName = pName.replace('-', '_') logger.info("Executing runGliderLoader with url = %s", url) try: runGliderLoader(url, loader.campaignName, il.campaignDescription, aName, pName, colors.pop(), 'glider', 'Glider Mission', loader.parms, loader.dbAlias, stride, loader.startDatetime, loader.endDatetime, il.grdTerrain) except Exception, e: logger.error('%s. Skipping this dataset.', e)
def loadGliders(loader, stride=1): ''' Crawl the IOOS Glider TDS for OPeNDAP links of Time aggregated files and load into STOQS ''' c = Crawl("http://tds.gliders.ioos.us/thredds/catalog.xml", select=[".*_Time$"]) urls = [s.get("url") for d in c.datasets for s in d.services if s.get("service").lower() == "opendap"] colors = loader.colors.values() for url in urls: aName = url.split('/')[-1].split('.')[0] pName = aName.replace('_Time', '') if pName.find('-') != -1: logger.warn("Replacing '-' characters in platform name %s with '_'s", pName) pName = pName.replace('-', '_') logger.info("Executing runGliderLoader with url = %s", url) try: runGliderLoader(url, loader.campaignName, il.campaignDescription, aName, pName, colors.pop(), 'glider', 'Glider Mission', loader.parms, loader.dbAlias, stride, loader.startDatetime, loader.endDatetime, il.grdTerrain) except Exception, e: logger.error('%s. Skipping this dataset.', e)
# Load only the March 2016 event lores Mooring data for ms2 campaign.hires_event_times = [] campaign.lores_event_times = [campaign.lores_event_times[1]] campaign.cl.ccems2_start_datetime, campaign.cl.ccems2_end_datetime = campaign.lores_event_times[ 0] campaign.load_ccemoorings(stride=500, start_mooring=2, end_mooring=2) campaign.load_ccemoorings_ev(low_res_stride=500, start_mooring=2, end_mooring=2) # Add Trajectory data for the same time period l_662_url = 'http://legacy.cencoos.org/thredds/dodsC/gliders/Line66/OS_Glider_L_662_20151124_TS.nc' l_662_parms = ['TEMP', 'PSAL', 'FLU2'] runGliderLoader(l_662_url, campaign_name, '', '/'.join(l_662_url.split('/')[-1:]), 'SPRAY_L66a_Glider', '38978f', 'glider', 'Glider Mission', l_662_parms, db_alias, 10, campaign.lores_event_times[0][0], campaign.lores_event_times[0][1]) # Add Glider Trajectory data for a time period when we have LRAUV oxygen data l_662_url = 'http://legacy.cencoos.org/thredds/dodsC/gliders/Line66/OS_Glider_L_662_20180816_TS.nc' l_662_parms = ['TEMP', 'PSAL', 'FLU2', 'oxygen'] oxygen_start = datetime(2018, 9, 4, 22, 22, 0) oxygen_end = datetime(2018, 9, 5, 1, 58, 0) runGliderLoader(l_662_url, campaign_name, '', '/'.join(l_662_url.split('/')[-1:]), 'SPRAY_L66a_Glider', '38978f', 'glider', 'Glider Mission', l_662_parms, db_alias, 1, oxygen_start, oxygen_end) # Load Daphne data to test for same Parameter name (oxygen from l_662) having different units url = 'http://dods.mbari.org/opendap/data/lrauv/daphne/missionlogs/2018/20180904_20180911/20180904T210211/201809042102_201809050138_10S_sci.nc'
campaign = CCE_2015_Campaign(db_alias, campaign_name) loader = Loader() campaigns = Campaigns() loader.args = Namespace() loader.args.test = False loader.args.clobber = True loader.args.db = db_alias loader.args.drop_indexes = False campaigns.campaigns = {db_alias: 'CCE/loadCCE_2015.py'} loader.load(campaigns, create_only=True) # Load only the March 2016 event lores Mooring data for ms2 campaign.hires_event_times = [] campaign.lores_event_times = [campaign.lores_event_times[1]] campaign.cl.ccems2_start_datetime, campaign.cl.ccems2_end_datetime = campaign.lores_event_times[0] campaign.load_ccemoorings(stride=500, start_mooring=2, end_mooring=2) campaign.load_ccemoorings_ev(low_res_stride=500, start_mooring=2, end_mooring=2) # Add Trajectory data for the same time period l_662_url = 'http://legacy.cencoos.org/thredds/dodsC/gliders/Line66/OS_Glider_L_662_20151124_TS.nc' l_662_parms = ['TEMP', 'PSAL', 'FLU2'] runGliderLoader(l_662_url, campaign_name, '', '/'.join(l_662_url.split('/')[-1:]), 'SPRAY_L66a_Glider', '38978f', 'glider', 'Glider Mission', l_662_parms, db_alias, 10, campaign.lores_event_times[0][0], campaign.lores_event_times[0][1]) print("All Done.")