Пример #1
0
    def get_uv_cons(self, btypes):
        self.ifcons = {}
        for b in range(0, len(btypes)):
            Lat = []
            Lon = []
            self.ifcons[b] = {}
            if (btypes[b]['ifltype']['value']
                    == 3) or (btypes[b]['ifltype']['value'] == 5):
                file = btypes[b]['ifltype']['filename']
                var = btypes[b]['ifltype']['vars']

                for node_i in self.nnode[b]:
                    Lat.append(self.hgrid.latitude[int(node_i)])
                    Lon.append(self.hgrid.longitude[int(node_i)])

            HC, tfreq, constidx = extract_HC(file,
                                             var,
                                             Lon,
                                             Lat,
                                             logger=self.logger)
            const = t_getconsts(np.array([]))

            for i, n in enumerate(constidx):
                self.ifcons[b][const[0]['name'][n].decode('UTF-8')] = {}
                for k in var:
                    k = k.split('_')[0]
                    self.ifcons[b][const[0]['name'][n].decode('UTF-8')][
                        k + '_amp'] = HC[k][i, 0, :]
                    self.ifcons[b][const[0]['name'][n].decode('UTF-8')][
                        k + '_pha'] = np.mod(HC[k][i, 2, :], 360)
Пример #2
0
    def add_tide(self, tidal):

        self.HC, self.tfreq, self.constidx = extract_HC(tidal['filename'],
                                                        tidal['vars'],
                                                        self.llon,
                                                        self.llat,
                                                        logger=self.logger)
        self.tidal = True
        if len(self.HC.keys()) > 1:
            self.ivs = 2