def create_coverage_dataset(self,name,wms_url,netcdf_url,low_res_url, data_range_from, data_range_to, is_categorical): """ Creates a coverage dataset in the EcoMaps DB @param name: Display name of the dataset @param wms_url: Endpoint for the mapping server @param netcdf_url: URL of the OpenDAP endpoint for this dataset @param low_res_url: URL for accessing the NetCDF file over the HTTP protocol @param data_range_from: Low range for the data @param data_range_to: High range for the data @param is_categorical: Set to true if the data is categorical (not continuous) """ with self.transaction_scope() as session: dataset_type = session.query(DatasetType).filter(DatasetType.type=='Coverage').one() dataset = Dataset() dataset.name = name dataset.dataset_type = dataset_type dataset.netcdf_url = netcdf_url dataset.wms_url = wms_url dataset.low_res_url = low_res_url dataset.data_range_from = data_range_from dataset.data_range_to = data_range_to dataset.is_categorical = is_categorical session.add(dataset)
def test_analysis_run(self): handler = logging.StreamHandler(sys.stderr) handler.setLevel(logging.DEBUG) log.setLevel(logging.DEBUG) try: #log.basicConfig(stream=sys.stderr) log.addHandler(handler) with working_directory( EcomapsAnalysisWorkingDirectory(), os.path.join(os.path.dirname(__file__), '../code_root')) as dir: # CEH Chess Data coverage_ds = Dataset() #coverage_ds.name = 'CHESS 1971 01' #coverage_ds.netcdf_url = 'http://*****:*****@test.com') analysis.run(point_url='http://thredds-prod.nerc-lancaster.ac.uk/thredds/dodsC/ECOMAPSDetail/ECOMAPSInputLOI01.nc', coverage_dict=coverage_dict, progress_fn=progress) finally: log.removeHandler(handler) # Remove me to test analysis code return
def create_point_dataset(self,name,wms_url,netcdf_url): """ Creates a point dataset in the EcoMaps DB @param name: Display name of the dataset @param wms_url: Endpoint for the mapping server @param netcdf_url: URL of the OpenDAP endpoint for this dataset """ with self.transaction_scope() as session: dataset_type = session.query(DatasetType).filter(DatasetType.type=='Point').one() dataset = Dataset() dataset.name = name dataset.dataset_type = dataset_type dataset.netcdf_url = netcdf_url dataset.wms_url = wms_url dataset.low_res_url = None session.add(dataset)