示例#1
0
    def __init__(self, fileName):

        # ~~> Read the steering file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        if not path.exists(fileName):
            print '... Could not file your DELWAQ file: ', fileName
            sys.exit(1)
        self.dwqList = self.parseDWQ(getFileContent(fileName))

        # ~~> Read the geometry file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        fle = self.dwqList['grid-indices-file']
        if not path.exists(fle):
            print '...Could not find the GEO file: ', fle
            sys.exit(1)
        self.geo = SELAFIN(fle)
        self.NPOIN3 = int(self.dwqList['grid-cells-first-direction'])
        if self.NPOIN3 != self.geo.NPOIN3:
            print '...In consistency in numbers with GEO file: ', self.NPOIN3, self.geo.NPOIN3
            sys.exit(1)
        self.NSEG3 = int(self.dwqList['grid-cells-second-direction'])

        # ~~> Read the CONLIM file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        fle = self.dwqList['grid-coordinates-file']
        if not path.exists(fle):
            print '...Could not find the CONLIM file: ', fle
            sys.exit(1)
        self.conlim = CONLIM(fle)

        # ~~> Time records ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        self.HYDRO0T = int(self.dwqList['hydrodynamic-start-time'])
        self.HYDROAT = int(self.dwqList['hydrodynamic-stop-time'])
        self.HYDRODT = int(self.dwqList['hydrodynamic-timestep'])
        self.HYDROIT = 1 + (self.HYDROAT - self.HYDRO0T) / self.HYDRODT
        self.HYDRO00 = 0
        self.tfrom = self.HYDRO0T
        self.tstop = self.HYDROAT
示例#2
0
    def __init__(self,
                 SLFfileName,
                 CLMfileName,
                 SEQfileName='',
                 splitCONLIM=False,
                 DOMfileRoot=''):

        print '\n... Acquiring global files'
        # ~~> Acquire global CONLIM file
        print '    +> CONLIM file'
        self.clm = CONLIM(CLMfileName)
        self.isCONLIM = splitCONLIM

        # ~~> Acquire global SELAFIN file
        print '    +> SELAFIN file'
        self.slf = SELAFIN(SLFfileName)

        # ~~> Acquire global SELAFIN file
        if SEQfileName != '':
            print '    +> SEQUENCE file'
            self.NPARTS, self.NSPLIT, self.KSPLIT = self.getSplitFromSequence(
                np.array(getFileContent(SEQfileName), dtype='<i4'))
        else:
            self.NPARTS, self.NSPLIT, self.KSPLIT = self.getSplitFromNodeValues(
                'PROCESSORS')

        print '\n... Split by elements in ', self.NPARTS, ' parts\n'

        # ~~> Clean inconsistencies in boundary segments
        self.IPOBO, self.NSPLIT, self.KSPLIT = self.setSplitForBoundaries(
            self.NSPLIT, self.clm.KFRGL, self.KSPLIT)

        self.PINTER,self.PNHALO,self.PNODDS = \
           self.setSplitForElements( self.IPOBO,self.NPARTS,self.NSPLIT,self.KSPLIT )
        self.slfn = self.copyCommonData()

        # ~~> Optional output file names
        self.isDOMAIN = DOMfileRoot
示例#3
0
    options = parser.parse_args()

    # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    # ~~~~ cli+slf new mesh ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cliFile = options.args[0]
    if not path.exists(cliFile):
        print '... the provided cliFile does not seem to exist: ' + cliFile + '\n\n'
        sys.exit(1)
    geoFile = options.args[1]
    if not path.exists(cliFile):
        print '... the provided geoFile does not seem to exist: ' + geoFile + '\n\n'
        sys.exit(1)

    # Read the new CLI file to get boundary node numbers
    print '   +> getting hold of the CONLIM file and of its liquid boundaries'
    cli = CONLIM(cliFile)
    # Keeping only open boundary nodes
    BOR = np.extract(cli.BOR['lih'] != 2, cli.BOR['n'])

    # Find corresponding (x,y) in corresponding new mesh
    print '   +> getting hold of the GEO file and of its bathymetry'
    geo = SELAFIN(geoFile)
    xys = np.vstack((geo.MESHX[BOR - 1], geo.MESHY[BOR - 1])).T
    bat = geo.getVariablesAt(0,
                             subsetVariablesSLF("BOTTOM: ",
                                                geo.VARNAMES)[0])[0]

    # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    # ~~~~ slf existing res ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    slfFile = options.args[2]
    if not path.exists(cliFile):