Example #1
0
    def __variables(self, key):
        var_id_names = self.__var_id_names(key)
        #var_nm_names=self.__var_nm_names(key)

        var_indices = self.__indices(var_id_names)
        cnt = False
        if len(var_id_names) > 1:
            outvals = zeros(map(
                len, (self.dimensions['TSTEP'], self.dimensions['LAY'],
                      self.dimensions['ROW'], self.dimensions['COL'])),
                            dtype='>f')
            for k in var_id_names:
                outvals[...] += self.__child.variables[k]
        else:
            outvals = self.__child.variables[var_id_names[0]]

        dimensions = ('TSTEP', 'VAR', 'LAY', 'ROW', 'COL')
        v = PseudoIOAPIVariable(self,
                                key,
                                'f',
                                dimensions,
                                values=outvals,
                                units='ppm')
        v.VAR_NAMES = ''.join([nm.ljust(16) for nm in var_id_names])
        #v.VAR_NAME_DESCS=''.join([nm.ljust(16) for nm in var_nm_names])
        return v
Example #2
0
    def __readonespc(self, spc):
        self.__file.seek(0, 2)
        #print(self.__file.tell())
        self.__seektospc(spc)
        #print(self.__file.tell())
        vals = zeros((self.NSTEPS, self.__time_spc_slice), '>f')
        for hri in range(self.NSTEPS):
            vals[hri, :] = fromfile(self.__file, '>f', self.__time_spc_slice)
            self.__file.seek(self.__inc, 1)

        vals = vals.reshape(self.NSTEPS, self.NLAYS,
                            self.__time_spc_layer_slice)
        vals = vals[:, :, 12:-1]
        vals = vals.reshape(self.NSTEPS, self.NLAYS, self.NROWS, self.NCOLS)
        units = {
            'AVERAGE   ': 'ppm',
            'AIRQUALITY': 'ppm',
            'EMISSIONS ': 'mol'
        }[self.NAME].ljust(16)
        vals = PseudoIOAPIVariable(self,
                                   spc,
                                   'f', ('TSTEP', 'LAY', 'ROW', 'COL'),
                                   values=vals,
                                   units=units)

        return vals
Example #3
0
    def __variables(self, k):
        dimensions = ('TSTEP', 'LAY', 'ROW', 'COL')
        outvals = self.__memmap__[k]['DATA']
        units = get_uamiv_units(self.NAME, k, self._aerosol_names)

        return PseudoIOAPIVariable(self, k, 'f', dimensions, values=outvals,
                                   units=units)
Example #4
0
 def __variables(self,k):
     spc_index=self.__var_names__.index(k)
     edgename = k.split('_')[0]
     spcname = k[len(edgename)+1:]
     if edgename in ('WEST', 'EAST'):
         dimensions=('TSTEP', 'ROW', 'LAY')
     else:
         dimensions=('TSTEP', 'COL', 'LAY')
     outvals=self.__memmap__[spcname][edgename]['DATA']
     units = get_uamiv_units(self.NAME, spcname)
     
     return PseudoIOAPIVariable(self,k,'f',dimensions,values=outvals, units = units)
Example #5
0
    def __variables(self, key):
        var_id_names = self.__var_id_names(key)
        # var_nm_names=self.__var_nm_names(key)

        var_indices = self.__indices(var_id_names)
        cnt = False
        if len(var_id_names) > 1:
            outvals = zeros(
                map(
                    len,
                    (self.dimensions["TSTEP"], self.dimensions["LAY"], self.dimensions["ROW"], self.dimensions["COL"]),
                ),
                dtype=">f",
            )
            for k in var_id_names:
                outvals[...] += self.__child.variables[k]
        else:
            outvals = self.__child.variables[var_id_names[0]]

        dimensions = ("TSTEP", "VAR", "LAY", "ROW", "COL")
        v = PseudoIOAPIVariable(self, key, "f", dimensions, values=outvals, units="ppm")
        v.VAR_NAMES = "".join([nm.ljust(16) for nm in var_id_names])
        # v.VAR_NAME_DESCS=''.join([nm.ljust(16) for nm in var_nm_names])
        return v