oas_dev/util/Nd/sizedist_class_v2/__init__.py
def compute_sizedist_sec_tot(self, chunks=None):
        """
        Compute total of sizedistribution sectional total
        :param chunks:
        :return:
        :return:
        """
        if chunks is None:
            chunks = self.chunks
        dNdlogD_var = D_NDLOG_D_SEC
        fn_final = self.dataset_savepath_var(dNdlogD_var, self.case_name, self.model_name)
        if os.path.isfile(fn_final):
            log.ger.info('opening :%s'%fn_final  )
            return xr.open_dataset(fn_final)
        # vs_NCONC = varListNorESM['NCONC']
        if not self.isSectional:
            return
        input_vars = self.get_varlist_input_sec()
        #
        start = time.time()
        l_vars_dNdlogD = []
        fl = []
        for var in input_vars:
            dNdlogD_var_nr = _varname_sec_nr(var)
            fl.append(self.make_sure_sizedist_varfile_exists(dNdlogD_var_nr))
            l_vars_dNdlogD.append(dNdlogD_var_nr)
        fl = list(dict.fromkeys(fl))
        ds = xr.open_mfdataset(fl, combine='by_coords', chunks=chunks, parallel=True)
        da = sum_vars(ds, l_vars_dNdlogD, dNdlogD_var, long_name='dN/dlogD (sectional)')
        # ex_var = l_vars_dNdlogD[0]
        # keep_coords = list(ds[ex_var].dims)
        # drop_l = list(set(ds.variables) - set(l_vars_dNdlogD + keep_coords))
        # ds = ds.drop(drop_l)
        # log.ger.warning(ds)
        # da = ds.to_array(dim='variable', name=dNdlogD_var)  # 'dNdlogD_mod')
        # da = da.sum('variable')
        self.to_netcdf(da, fn_final)  # da.to_netcdf(fn_final, compute=False)  # , chunks={'diameter':1})
        # delayed_obj =self.to_netcdf(da,fn_final)# da.to_netcdf(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)

        # return #ds

        Compute total of sizedistribution sectional total
        :param chunks:
        :return:
        :return:
        
Compute total of sizedistribution sectional total
Compute total of sizedistribution sectional total
def compute_sizedist_sec_tot(self, chunks=None):
        if chunks is None:
            chunks = self.chunks
        dNdlogD_var = D_NDLOG_D_SEC
        fn_final = self.dataset_savepath_var(dNdlogD_var, self.case_name, self.model_name)
        if os.path.isfile(fn_final):
            log.ger.info('opening :%s'%fn_final  )
            return xr.open_dataset(fn_final)
        if not self.isSectional:
            return
        input_vars = self.get_varlist_input_sec()
        start = time.time()
        l_vars_dNdlogD = []
        fl = []
        for var in input_vars:
            dNdlogD_var_nr = _varname_sec_nr(var)
            fl.append(self.make_sure_sizedist_varfile_exists(dNdlogD_var_nr))
            l_vars_dNdlogD.append(dNdlogD_var_nr)
        fl = list(dict.fromkeys(fl))
        ds = xr.open_mfdataset(fl, combine='by_coords', chunks=chunks, parallel=True)
        da = sum_vars(ds, l_vars_dNdlogD, dNdlogD_var, long_name='dN/dlogD (sectional)')
         ex_var = l_vars_dNdlogD[0]
         keep_coords = list(ds[ex_var].dims)
         drop_l = list(set(ds.variables) - set(l_vars_dNdlogD + keep_coords))
         ds = ds.drop(drop_l)
         log.ger.warning(ds)
         da = ds.to_array(dim='variable', name=dNdlogD_var)   'dNdlogD_mod')
         da = da.sum('variable')
        self.to_netcdf(da, fn_final)   da.to_netcdf(fn_final, compute=False)   , chunks={'diameter':1})
         delayed_obj =self.to_netcdf(da,fn_final) da.to_netcdf(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)
         return ds
def compute_sizedist_sec_tot ( self , chunks = None ) : if chunks is None : chunks = self . chunks dNdlogD_var = D_NDLOG_D_SEC fn_final = self . dataset_savepath_var ( dNdlogD_var , self . case_name , self . model_name ) if os . path . isfile ( fn_final ) : log . ger . info ( 'opening :%s' % fn_final ) return xr . open_dataset ( fn_final ) if not self . isSectional : return input_vars = self . get_varlist_input_sec ( ) start = time . time ( ) l_vars_dNdlogD = [ ] fl = [ ] for var in input_vars : dNdlogD_var_nr = _varname_sec_nr ( var ) fl . append ( self . make_sure_sizedist_varfile_exists ( dNdlogD_var_nr ) ) l_vars_dNdlogD . append ( dNdlogD_var_nr ) fl = list ( dict . fromkeys ( fl ) ) ds = xr . open_mfdataset ( fl , combine = 'by_coords' , chunks = chunks , parallel = True ) da = sum_vars ( ds , l_vars_dNdlogD , dNdlogD_var , long_name = 'dN/dlogD (sectional)' ) 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 sizedistribution sectional total
Compute total of sizedistribution sectional total
"""
        Compute total of sizedistribution sectional total
        :param chunks:
        :return:
        :return:
        """ # vs_NCONC = varListNorESM['NCONC'] # # ex_var = l_vars_dNdlogD[0] # keep_coords = list(ds[ex_var].dims) # drop_l = list(set(ds.variables) - set(l_vars_dNdlogD + keep_coords)) # ds = ds.drop(drop_l) # log.ger.warning(ds) # da = ds.to_array(dim='variable', name=dNdlogD_var)  # 'dNdlogD_mod') # da = da.sum('variable') # da.to_netcdf(fn_final, compute=False)  # , chunks={'diameter':1}) # delayed_obj =self.to_netcdf(da,fn_final)# da.to_netcdf(fn_final, compute=False)  # , chunks={'diameter':1}) # with ProgressBar(): #    results = delayed_obj.compute() # return #ds
None
None
self
chunks
None