def perform_nemo_tasks(datadir, expname, refdate): global log, tasks, table_dir, prefix validate_setup_settings() validate_run_settings(datadir, expname) nemo_tasks = [t for t in tasks if t.source.model_component() == "nemo"] log.info("Selected %d NEMO tasks from %d input tasks" % (len(nemo_tasks), len(tasks))) tableroot = os.path.join(table_dir, prefix) if not nemo2cmor.initialize(datadir, expname, tableroot, refdate): return nemo2cmor.execute(nemo_tasks)
def perform_nemo_tasks(datadir, expname, startdate, interval): global log, tasks, table_dir, prefix validate_setup_settings() validate_run_settings(datadir, expname) nemo_tasks = [ t for t in tasks if isinstance(t.source, cmor_source.nemo_source) ] log.info("Selected %d NEMO tasks from %d input tasks" % (len(nemo_tasks), len(tasks))) tableroot = os.path.join(table_dir, prefix) if (not nemo2cmor.initialize(datadir, expname, tableroot, startdate, interval)): return nemo2cmor.execute(nemo_tasks)
def test_cmor_single_task3d(self): tab_dir = get_table_path() conf_path = os.path.join(os.path.dirname(nemo2cmor.__file__), "resources", "metadata-template.json") cmor.setup(tab_dir) cmor.dataset_json(conf_path) nemo2cmor.initialize(self.data_dir, "exp", os.path.join(tab_dir, "CMIP6"), datetime.datetime(1990, 3, 1), datetime.timedelta(days=365)) src = cmor_source.netcdf_source("to", "nemo") tgt = cmor_target.cmor_target("thetao", "Omon") setattr(tgt, "frequency", "mon") setattr(tgt, "dimensions", "longitude latitude olevel time") setattr(tgt, "time_operator", ["mean"]) tgt.dims = 3 tsk = cmor_task.cmor_task(src, tgt) nemo2cmor.execute([tsk]) nemo2cmor.finalize() cmor.close()
def test_cmor_single_task3d(self): tab_dir = init_cmor() nemo2cmor.initialize(self.data_dir, "expn", os.path.join(tab_dir, "CMIP6"), datetime.datetime(1990, 3, 1), testmode=True) src = cmor_source.netcdf_source("to", "nemo") tgt = cmor_target.cmor_target("thetao", "Omon") setattr(tgt, "frequency", "mon") setattr(tgt, "dimensions", "longitude latitude olevel time") setattr(tgt, "time_operator", ["mean"]) tgt.space_dims = {"latitude", "longitude"} tsk = cmor_task.cmor_task(src, tgt) nemo2cmor.execute([tsk]) nemo2cmor.finalize() cmor.close()
def test_cmor_single_task3d(self): tab_dir = get_table_path() conf_path = ece2cmorlib.conf_path_default cmor.setup(tab_dir) cmor.dataset_json(conf_path) cmor.set_cur_dataset_attribute("calendar", "proleptic_gregorian") nemo2cmor.initialize(self.data_dir, "exp", os.path.join(tab_dir, "CMIP6"), datetime.datetime(1990, 3, 1)) src = cmor_source.netcdf_source("to", "nemo") tgt = cmor_target.cmor_target("thetao", "Omon") setattr(tgt, "frequency", "mon") setattr(tgt, "dimensions", "longitude latitude olevel time") setattr(tgt, "time_operator", ["mean"]) tgt.space_dims = {"latitude", "longitude"} tsk = cmor_task.cmor_task(src, tgt) nemo2cmor.execute([tsk]) nemo2cmor.finalize() cmor.close()