How to use the ert.enkf.NodeId function in ert

To help you get started, we’ve selected a few ert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Ensembles / ert / devel / python / python / ert / server / ertrpcserver.py View on Github external
def _storeData(self, enkf_node, fs, group_name, keyword, value, realization_number):
        node_id = NodeId(0, realization_number)
        enkf_node.tryLoad(fs, node_id)  # Fetch any data from previous store calls
        custom_kw = enkf_node.asCustomKW()
        custom_kw[keyword] = value

        if not enkf_node.save(fs, node_id):
            raise createFault(UserWarning, "Unable to store data for group: '%s' and key: '%s' into realization: '%d'" % (group_name, keyword, realization_number))
github OPM / ResInsight / ThirdParty / Ert / python / python / ert / enkf / data / enkf_node.py View on Github external
def tryLoad(self, fs, node_id):
        """
        @type fs: EnkfFS
        @type node_id: NodeId
        @rtype: bool
        """
        if not isinstance(fs, EnkfFs):
            raise TypeError('fs must be an EnkfFs, not %s' % type(fs))
        if not isinstance(node_id, NodeId):
            raise TypeError('node_id must be a NodeId, not %s' % type(node_id))

        return self._try_load(fs, node_id)
github Ensembles / ert / python / python / ert / server / ertrpcserver.py View on Github external
def _initializeRealization(self, target_fs, geo_id, iens, keywords):
        ens_config = self.ert.ensembleConfig()

        for kw in ens_config.getKeylistFromVarType(EnkfVarType.PARAMETER):
            if not kw in keywords:
                config_node = ens_config[kw]
                data_node = EnkfNode( config_node )
                init_id = NodeId(0, geo_id)
                run_id = NodeId(0, iens)
                data_node.load(self._getInitializationCase(), init_id)
                data_node.save(target_fs, run_id)

        for key, values in keywords.items():
            config_node = ens_config[key]
            data_node = EnkfNode( config_node )

            gen_kw = data_node.asGenKw()
            gen_kw.setValues(values)

            run_id = NodeId(0, iens)
            data_node.save(target_fs, run_id)

        target_fs.fsync()
        state_map = target_fs.getStateMap()
        state_map[iens] = RealizationStateEnum.STATE_INITIALIZED
github OPM / ResInsight / ThirdParty / Ert / devel / python / python / ert / server / ertrpcserver.py View on Github external
def _initializeRealization(self, target_fs, geo_id, iens, keywords):
        state = self.ert.getRealisation(iens)
        ens_config = self.ert.ensembleConfig()

        for kw in ens_config.getKeylistFromVarType(EnkfVarType.PARAMETER):
            if not kw in keywords:
                node = state[kw]
                init_id = NodeId(0, geo_id)
                run_id = NodeId(0, iens)
                node.load(self._getInitializationCase(), init_id)
                node.save(target_fs, run_id)

        for key, value in keywords.iteritems():
            node = state[key]
            gen_kw = node.asGenKw()
            gen_kw.setValues(value)

            run_id = NodeId(0, iens)
            node.save(target_fs, run_id)

        target_fs.fsync()
        state_map = target_fs.getStateMap()
        state_map[iens] = RealizationStateEnum.STATE_INITIALIZED
github Ensembles / ert / python / python / ert / server / ertrpcserver.py View on Github external
def _storeData(self, enkf_node, fs, group_name, keyword, value, realization_number):
        node_id = NodeId(0, realization_number)
        enkf_node.tryLoad(fs, node_id)  # Fetch any data from previous store calls
        custom_kw = enkf_node.asCustomKW()
        custom_kw[keyword] = value

        if not enkf_node.save(fs, node_id):
            raise createFault(UserWarning, "Unable to store data for group: '%s' and key: '%s' into realization: '%d'" % (group_name, keyword, realization_number))
github Ensembles / ert / devel / python / python / ert / server / ertrpcserver.py View on Github external
ens_config = self.ert.ensembleConfig()

        for kw in ens_config.getKeylistFromVarType(EnkfVarType.PARAMETER):
            if not kw in keywords:
                node = state[kw]
                init_id = NodeId(0, geo_id)
                run_id = NodeId(0, iens)
                node.load(self._getInitializationCase(), init_id)
                node.save(target_fs, run_id)

        for key, value in keywords.iteritems():
            node = state[key]
            gen_kw = node.asGenKw()
            gen_kw.setValues(value)

            run_id = NodeId(0, iens)
            node.save(target_fs, run_id)

        target_fs.fsync()
        state_map = target_fs.getStateMap()
        state_map[iens] = RealizationStateEnum.STATE_INITIALIZED
github OPM / ResInsight / ThirdParty / Ert / devel / python / python / ert / server / ertrpcserver.py View on Github external
def _storeData(self, enkf_node, fs, group_name, keyword, value, realization_number):
        node_id = NodeId(0, realization_number)
        enkf_node.tryLoad(fs, node_id)  # Fetch any data from previous store calls
        custom_kw = enkf_node.asCustomKW()
        custom_kw[keyword] = value

        if not enkf_node.save(fs, node_id):
            raise createFault(UserWarning, "Unable to store data for group: '%s' and key: '%s' into realization: '%d'" % (group_name, keyword, realization_number))
github OPM / ResInsight / ThirdParty / Ert / devel / python / python / ert / enkf / data / enkf_node.py View on Github external
def tryLoad(self, fs, node_id):
        """
        @type fs: EnkfFS
        @type node_id: NodeId
        @rtype: bool
        """
        assert isinstance(fs, EnkfFs)
        assert isinstance(node_id, NodeId)

        return EnkfNode.cNamespace().try_load(self, fs, node_id)
github OPM / ResInsight / ThirdParty / Ert / devel / python / python / ert / server / ert_server.py View on Github external
def handleADD_SIMULATION(self , args):
        geo_id = args[0]
        pert_id = args[1]
        iens = args[2]
        self.logger.debug("ADD_SIMULATION  geo_id:%d  pert_id:%d  iens:%d" % (geo_id , pert_id , iens))
        kw_list = args[3]
        state = self.ert_handle.getRealisation( iens )
        state.addSubstKeyword( "GEO_ID" , "%d" % geo_id )
        
        elco_kw = [ l[0] for l in kw_list ]
        ens_config = self.ert_handle.ensembleConfig()

        for kw in ens_config.getKeylistFromVarType( EnkfVarType.PARAMETER ):
            if not kw in elco_kw:
                node = state[kw]
                init_id = NodeId(0 , geo_id , EnkfStateType.ANALYZED )
                run_id = NodeId(0 , iens , EnkfStateType.ANALYZED )
                node.load( self.init_fs , init_id )
                node.save( self.run_fs , run_id )
            
        for kw_arg in kw_list:
            kw = str(kw_arg[0])
            data = kw_arg[1:]
            self.logger.debug("ADD_SIMULATION %s : %s" % (kw , data))
        
            node = state[kw]
            gen_kw = node.asGenKw()
            gen_kw.setValues(data)
        
            run_id = NodeId(0 , iens , EnkfStateType.ANALYZED )
            node.save( self.run_fs , run_id )