def buildProduct(self, dsid: str, request: TaskRequest, node: OpNode, result_arrays: List[EDASArray], attrs: Dict[str, str]): result_dset = EDASDataset.init(self.renameResults(result_arrays, node), attrs) for parm in ["product", "archive"]: result_dset[parm] = node.getParm(parm, "") result_dset.name = node.getResultId(dsid) return self.signResult(result_dset, request, node)
def mergeEnsembles(self, op: OpNode, dset: EDASDataset) -> EDASDataset: self.logger.info(" ---> Merge Ensembles: ") for xarray in dset.xarrays: self.logger.info( f" Variable {xarray.name}: dims: {xarray.dims}, coords: {xarray.coords.keys()} " ) sarray: xr.DataArray = xr.concat(dset.xarrays, dim=op.ensDim) result = EDASArray(dset.id, list(dset.domains)[0], sarray) return EDASDataset.init(OrderedDict([(dset.id, result)]), dset.attrs)
def getCachedDataset(self, snode: SourceNode) -> Optional[EDASDataset]: cache_status = self.getCacheStatus(snode) if cache_status != CacheStatus.Ignore: cid = snode.varSource.getId() variable = EDASKCacheMgr[cid] if variable is None: assert cache_status == CacheStatus.Option, "Missing cached input: " + cid else: return EDASDataset.init(OrderedDict([(cid, variable)]), {}) return None