コード例 #1
0
ファイル: ensemble.py プロジェクト: muguangyuze/RHEAS
 def readStateFiles(self):
     """Read initial state files for each ensemble member."""
     cells = []
     _, vegfile, snowbandfile = self.models[0].paramFromDB()
     veg = state.readVegetation("{0}/{1}".format(rpath.data, vegfile))
     bands, _ = state.readSnowbands(
         "{0}/{1}".format(rpath.data, snowbandfile))
     for filename in self.statefiles:
         c, _, _, _ = state.readStateFile(filename)
         cells.append(c)
     return cells, veg, bands
コード例 #2
0
 def readStateFiles(self):
     """Read initial state files for each ensemble member."""
     cells = []
     _, vegfile, snowbandfile = self.models[0].paramFromDB()
     veg = state.readVegetation("{0}/{1}".format(rpath.data, vegfile))
     bands, _ = state.readSnowbands(
         "{0}/{1}".format(rpath.data, snowbandfile))
     for filename in self.statefiles:
         c, _, _, _ = state.readStateFile(filename)
         cells.append(c)
     return cells, veg, bands
コード例 #3
0
ファイル: ensemble.py プロジェクト: muguangyuze/RHEAS
    def updateStateFiles(self, data, alat, alon, agid):
        """Update initial state files with *data*."""
        _, vegparam, snowbands = self.models[0].paramFromDB()
        veg = state.readVegetation("{0}/{1}".format(rpath.data, vegparam))
        bands, _ = state.readSnowbands("{0}/{1}".format(rpath.data, snowbands))
        for e, statefile in enumerate(self.statefiles):
            states, nlayer, nnodes, dateline = state.readStateFile(statefile)
            for var in data:
                x = state.readVariable(self.models[e], states, alat[var], alon[
                                       var], veg, bands, nlayer, var)

                states = state.updateVariable(self.models[e], states, x, data[var][:, e], alat[
                                              var], alon[var], agid, veg, bands, nlayer, var)
            state.writeStateFile(statefile, states, "{0}\n{1} {2}".format(
                dateline.strip(), nlayer, nnodes))
コード例 #4
0
    def updateStateFiles(self, data, alat, alon, agid):
        """Update initial state files with *data*."""
        _, vegparam, snowbands = self.models[0].paramFromDB()
        veg = state.readVegetation("{0}/{1}".format(rpath.data, vegparam))
        bands, _ = state.readSnowbands("{0}/{1}".format(rpath.data, snowbands))
        for e, statefile in enumerate(self.statefiles):
            states, nlayer, nnodes, dateline = state.readStateFile(statefile)
            for var in data:
                x = state.readVariable(self.models[e], states, alat[var], alon[
                                       var], veg, bands, nlayer, var)

                states = state.updateVariable(self.models[e], states, x, data[var][:, e], alat[
                                              var], alon[var], agid, veg, bands, nlayer, var)
            state.writeStateFile(statefile, states, "{0}\n{1} {2}".format(
                dateline.strip(), nlayer, nnodes))