def calculate_pm25_components(ds): """ Calcualtes and add to dataset SIA, SOA, POA, dust, seasalt contributions to PM2.5. NB: BC contribution is Need to call function calculate_pm25_species_3bins before use. :param ds: WRF-chem output. :type ds: xarray DataSet. :return: Dataset with added components. :rtype: xarray DataSet. """ # Secondary Organic Aerosols SOA. ds['pm25_SOA'] = utl._sum_(ds['pm25_biog1_o'], ds['pm25_biog1_c'], ds['pm25_smpbb'], ds['pm25_smpa'], ds['pm25_glysoa_sfc']) ds['pm25_SOA'].attrs['units'] = 'ug m-3' # Secondary Inorganic Aerosols SIA. ds['pm25_SIA'] = utl._sum_(ds['pm25_so4'], ds['pm25_nh4'], ds['pm25_no3']) ds['pm25_SIA'].attrs['units'] = 'ug m-3' #Primary Organic Aerosols ds['pm25_POA'] = ds['pm25_oc'] #Seasalt ds['pm25_seasalt'] = utl._sum_(ds['pm25_na'], ds['pm25_cl']) ds['pm25_seasalt'].attrs['units'] = 'ug m-3' #Dust ds['pm25_dust'] = ds['pm25_oin']
def calculate_tot_pm(ds): """ Add to dataset the calculated pm2.5 and PM10 in ug m-3 from components SIA POA SOA bc dust and seasalt. Total should be equal to the WRF-Chem variable PM2_5_DRY and PM10. Calculation for sum follows the calculation in WRF-Chem module_mosaic_sumpm.F subroutine sum_pm_mosaic_vbs4. :param ds: WRF-chem output. :type ds: xarray DataSet. :return: Dataset with added tot pm component. :rtype: xarray DataSet. """ # PM2.5. ds['pm25_tot'] = utl._sum_( ds['pm25_SOA'], ds['pm25_SIA'], ds['pm25_dust'], ds['pm25_sea'], ds['pm25_POA'], # POA (organic carbon). ds['pm25_bc']) ds['pm25_tot'].attrs['units'] = 'ug m-3' # PM10. ds['pm10_tot'] = utl._sum_( ds['pm10_SOA'], ds['pm10_SIA'], ds['pm10_dust'], ds['pm10_sea'], ds['pm10_POA'], # POA (organic carbon). ds['pm10_bc']) ds['pm10_tot'].attrs['units'] = 'ug m-3'
def calculate_total_pm25(ds): """ Add to dataset the calculated pm2.5 in ug m-3. Should be equal to the WRF-Chem variable PM2_5_DRY. Calcualation for sum follows the calculation in WRF-Chem module_mosaic_sumpm.F subroutine sum_pm_mosaic_vbs0. Need to call function calculate_pm25_species_3bins before use. :param ds: WRF-chem output. :type ds: xarray DataSet. :return: Dataset with added tot pm2.5 component. :rtype: xarray DataSet. """ ds['pm25_calc'] = utl._sum_( ds['pm25_biog1_o'], # SOA. ds['pm25_biog1_c'], ds['pm25_smpbb'], ds['pm25_smpa'], ds['pm25_glysoa_sfc'], ds['pm25_so4'], # SIA. ds['pm25_nh4'], ds['pm25_no3'], ds['pm25_bc'], ds['pm25_na'], # seasalt. ds['pm25_cl'], ds['pm25_oc'], # POA. ds['pm25_oin'] # dust. ) ds['pm25_calc'].attrs['units'] = 'ug m-3'
def calculate_pm25_species_3bins(ds): """ Add to datset each aerosol species contribution to pm2.5 in ug m-3. :param ds: WRF-chem output. :type ds: xarray DataSet. :return: Dataset with added components. :rtype: xarray DataSet. """ # List of aerosol species contributing to PM25. According to WRF-Chem code # in module_mosaic_sumpm.F subroutine sum_pm_mosaic_vbs0. species = [ 'so4', 'nh4', 'no3', 'biog1_o', 'biog1_c', 'smpbb', 'smpa', 'glysoa_sfc', 'oc', 'bc', 'oin', 'na', 'cl' ] conversion = ds['ALT'] # inverse densitiy. # Calculating contributions: summing up the first 3 bins # (diameter < 2.5 um) for each species. for species in species: ds['pm25_' + species] = utl._sum_(ds[species + '_a01'], ds[species + '_a02'], ds[species + '_a03']) / conversion ds['pm25_' + species].attrs['units'] = 'ug m-3'
def get_pm_species(ds): """ Add to datset each aerosol species contribution to pm2.5 and pm10 in ug m-3. :param ds: WRF-chem output. :type ds: xarray DataSet. :return: Dataset with added components. :rtype: xarray DataSet. """ # List of aerosol species contributing to PM. According to WRF-Chem code # in module_mosaic_sumpm.F subroutine sum_pm_mosaic_vbs4. species = [ 'so4', 'nh4', 'no3', 'glysoa_r1', 'glysoa_r2', 'glysoa_oh', 'glysoa_sfc', 'glysoa_nh4', 'oc', 'bc', 'oin', 'na', 'cl', 'asoaX', 'asoa1', 'asoa2', 'asoa3', 'asoa4', 'bsoaX', 'bsoa1', 'bsoa2', 'bsoa3', 'bsoa4', 'water' ] conv = ds.ALT # inverse densitiy. # Calculating contributions for PM2.5: summing up the first 3 bins # (diameter < 2.5 um) for each species. for sp in species: #convert species to ug/m3. # add PM2.5 components. ds['pm25_' + sp] = (utl._sum_(ds[sp + '_a01'], ds[sp + '_a02'], ds[sp + '_a03'])) / conv ds['pm25_' + sp].attrs['units'] = 'ug m-3' # add PM10 components (PM2.5 + bin04). ds['pm10_' + sp] = (ds['pm25_' + sp] + (ds[sp + '_a04'] / ds.ALT))
def get_pm_components(ds): """ Once calculated PM species, this function calcualtes and add to dataset SIA, SOA, POA, dust, seasalt contributions to PM2.5 and PM10. (NB: BC contribution is already calculated in get_pm_species). :param ds: WRF-chem output. :type ds: xarray DataSet. :return: Dataset with added components. :rtype: xarray DataSet. """ #PM2.5 # Secondary Organic Aerosols SOA. ds['pm25_SOA'] = utl._sum_( ds['pm25_glysoa_r1'], ds['pm25_glysoa_r2'], ds['pm25_glysoa_oh'], ds['pm25_glysoa_nh4'], ds['pm25_glysoa_sfc'], ds['pm25_asoaX'], ds['pm25_asoa1'], ds['pm25_asoa2'], ds['pm25_asoa3'], ds['pm25_asoa4'], ds['pm25_bsoaX'], ds['pm25_bsoa1'], ds['pm25_bsoa2'], ds['pm25_bsoa3'], ds['pm25_bsoa4']) ds['pm25_SOA'].attrs['units'] = 'ug m-3' ds['pm25_glySOA'] = utl._sum_(ds['pm25_glysoa_r1'], ds['pm25_glysoa_r2'], ds['pm25_glysoa_oh'], ds['pm25_glysoa_nh4'], ds['pm25_glysoa_sfc']) ds['pm25_glySOA'].attrs['units'] = 'ug m-3' ds['pm25_aSOA'] = utl._sum_(ds['pm25_asoaX'], ds['pm25_asoa1'], ds['pm25_asoa2'], ds['pm25_asoa3'], ds['pm25_asoa4']) ds['pm25_aSOA'].attrs['units'] = 'ug m-3' ds['pm25_bSOA'] = utl._sum_(ds['pm25_bsoaX'], ds['pm25_bsoa1'], ds['pm25_bsoa2'], ds['pm25_bsoa3'], ds['pm25_bsoa4']) ds['pm25_bSOA'].attrs['units'] = 'ug m-3' # Secondary Inorganic Aerosols SIA. ds['pm25_SIA'] = utl._sum_(ds['pm25_so4'], ds['pm25_nh4'], ds['pm25_no3']) ds['pm25_SIA'].attrs['units'] = 'ug m-3' #Primary Organic Aerosols. ds['pm25_POA'] = ds['pm25_oc'] #Tot OA. ds['pm25_OA'] = ds['pm25_POA'] + ds['pm25_SOA'] ds['pm25_OA'].attrs['units'] = 'ug m-3' #Seasalt. ds['pm25_sea'] = utl._sum_(ds['pm25_na'], ds['pm25_cl']) ds['pm25_sea'].attrs['units'] = 'ug m-3' #Dust ds['pm25_dust'] = ds['pm25_oin'] #for PM10 ds['pm10_SOA'] = utl._sum_( ds['pm10_glysoa_r1'], ds['pm10_glysoa_r2'], ds['pm10_glysoa_oh'], ds['pm10_glysoa_nh4'], ds['pm10_glysoa_sfc'], ds['pm10_asoaX'], ds['pm10_asoa1'], ds['pm10_asoa2'], ds['pm10_asoa3'], ds['pm10_asoa4'], ds['pm10_bsoaX'], ds['pm10_bsoa1'], ds['pm10_bsoa2'], ds['pm10_bsoa3'], ds['pm10_bsoa4']) ds['pm10_SOA'].attrs['units'] = 'ug m-3' ds['pm10_glySOA'] = utl._sum_(ds['pm10_glysoa_r1'], ds['pm10_glysoa_r2'], ds['pm10_glysoa_oh'], ds['pm10_glysoa_nh4'], ds['pm10_glysoa_sfc']) ds['pm10_glySOA'].attrs['units'] = 'ug m-3' ds['pm10_aSOA'] = utl._sum_(ds['pm10_asoaX'], ds['pm10_asoa1'], ds['pm10_asoa2'], ds['pm10_asoa3'], ds['pm10_asoa4']) ds['pm10_aSOA'].attrs['units'] = 'ug m-3' ds['pm10_bSOA'] = utl._sum_(ds['pm10_bsoaX'], ds['pm10_bsoa1'], ds['pm10_bsoa2'], ds['pm10_bsoa3'], ds['pm10_bsoa4']) ds['pm10_bSOA'].attrs['units'] = 'ug m-3' # Secondary Inorganic Aerosols SIA. ds['pm10_SIA'] = utl._sum_(ds['pm10_so4'], ds['pm10_nh4'], ds['pm10_no3']) ds['pm10_SIA'].attrs['units'] = 'ug m-3' #Primary Organic Aerosols. ds['pm10_POA'] = ds['pm10_oc'] #Tot OA. ds['pm10_OA'] = ds['pm10_POA'] + ds['pm10_SOA'] ds['pm10_OA'].attrs['units'] = 'ug m-3' #Seasalt. ds['pm10_sea'] = utl._sum_(ds['pm10_na'], ds['pm10_cl']) ds['pm10_sea'].attrs['units'] = 'ug m-3' #Dust ds['pm10_dust'] = ds['pm10_oin']