oas_dev/util/Nd/sizedist_class_v2/__init__.py
def compute_sizedist_mod_tot(self):
        """
        Compute total of modal, i.e. the sum of all modes.
        :return:
        """
        dNdlogD_var = D_NDLOG_D_MOD
        fn_final = self.dataset_savepath_var(dNdlogD_var, self.case_name, self.model_name)
        if os.path.isfile(fn_final):
            log.ger.info('Modal tot file found %s' % fn_final)
            return xr.open_dataset(fn_final)
        else:
            log.ger.info('Computing file %s'%fn_final)
        vs_NCONC = varListNorESM['NCONC']
        fl = []
        l_vars_dNdlogD = []
        for var in vs_NCONC:
            dNdlogD_var_nr = _varname_mod_nr(var)
            l_vars_dNdlogD.append(dNdlogD_var_nr)
            _f = self.make_sure_sizedist_varfile_exists(dNdlogD_var_nr)
            fl.append(_f)
            log.ger.debug('Modal tot file found %s' % var)
        log.ger.debug(fl)
        start = time.time()

        CHUNKS = {'diameter':20}
        ds = xr.open_mfdataset(fl, combine='by_coords', parallel=True, chunks=CHUNKS)  # .isel(diameter=slice(0,30))#.squeeze()

        da = sum_vars(ds, l_vars_dNdlogD, dNdlogD_var, long_name='dN/dlogD (modal)')
        self.to_netcdf(da, fn_final)  # , compute=False)  # , chunks={'diameter':1})
        # delayed_obj = self.to_netcdf(da, fn_final)#, compute=False)  # , chunks={'diameter':1})
        # with ProgressBar():
        #    results = delayed_obj.compute()
        end = time.time()
        log.ger.debug('Time elapsed: %f' % (end - start))
        ds.close()
        da.close()
        del da
        del ds
        return xr.open_dataset(fn_final)

        Compute total of modal, i.e. the sum of all modes.
        :return:
        
Compute total of modal, i.e. the sum of all modes.
Compute total of modal i . e . the sum of all modes .
def compute_sizedist_mod_tot(self):
        dNdlogD_var = D_NDLOG_D_MOD
        fn_final = self.dataset_savepath_var(dNdlogD_var, self.case_name, self.model_name)
        if os.path.isfile(fn_final):
            log.ger.info('Modal tot file found %s' % fn_final)
            return xr.open_dataset(fn_final)
        else:
            log.ger.info('Computing file %s'%fn_final)
        vs_NCONC = varListNorESM['NCONC']
        fl = []
        l_vars_dNdlogD = []
        for var in vs_NCONC:
            dNdlogD_var_nr = _varname_mod_nr(var)
            l_vars_dNdlogD.append(dNdlogD_var_nr)
            _f = self.make_sure_sizedist_varfile_exists(dNdlogD_var_nr)
            fl.append(_f)
            log.ger.debug('Modal tot file found %s' % var)
        log.ger.debug(fl)
        start = time.time()
        CHUNKS = {'diameter':20}
        ds = xr.open_mfdataset(fl, combine='by_coords', parallel=True, chunks=CHUNKS)  
        da = sum_vars(ds, l_vars_dNdlogD, dNdlogD_var, long_name='dN/dlogD (modal)')
        self.to_netcdf(da, fn_final)  
        end = time.time()
        log.ger.debug('Time elapsed: %f' % (end - start))
        ds.close()
        da.close()
        del da
        del ds
        return xr.open_dataset(fn_final)
def compute_sizedist_mod_tot ( self ) : dNdlogD_var = D_NDLOG_D_MOD fn_final = self . dataset_savepath_var ( dNdlogD_var , self . case_name , self . model_name ) if os . path . isfile ( fn_final ) : log . ger . info ( 'Modal tot file found %s' % fn_final ) return xr . open_dataset ( fn_final ) else : log . ger . info ( 'Computing file %s' % fn_final ) vs_NCONC = varListNorESM [ 'NCONC' ] fl = [ ] l_vars_dNdlogD = [ ] for var in vs_NCONC : dNdlogD_var_nr = _varname_mod_nr ( var ) l_vars_dNdlogD . append ( dNdlogD_var_nr ) _f = self . make_sure_sizedist_varfile_exists ( dNdlogD_var_nr ) fl . append ( _f ) log . ger . debug ( 'Modal tot file found %s' % var ) log . ger . debug ( fl ) start = time . time ( ) CHUNKS = { 'diameter' : 20 } ds = xr . open_mfdataset ( fl , combine = 'by_coords' , parallel = True , chunks = CHUNKS ) da = sum_vars ( ds , l_vars_dNdlogD , dNdlogD_var , long_name = 'dN/dlogD (modal)' ) self . to_netcdf ( da , fn_final ) end = time . time ( ) log . ger . debug ( 'Time elapsed: %f' % ( end - start ) ) ds . close ( ) da . close ( ) del da del ds return xr . open_dataset ( fn_final )
Compute total of modal, i.e.
Compute total of modal i . e .
"""
        Compute total of modal, i.e. the sum of all modes.
        :return:
        """ # .isel(diameter=slice(0,30))#.squeeze() # , compute=False)  # , chunks={'diameter':1}) # delayed_obj = self.to_netcdf(da, fn_final)#, compute=False)  # , chunks={'diameter':1}) # with ProgressBar(): #    results = delayed_obj.compute()
None
self