# ARTS built-in documentation server

## Workspace Method pndFromPsd

### Description

Calculates pnd_data from given psd_data for one scattering species. Performs integration of the size distribution over the size grid bin deriving pnd (units #/m3) from psd (units #/m3/m). Some checks on the sufficiency of the size grid range and coverage are applied. *quad_order* can be 0 for rectangular or 1 for trapezoidal integration. The only difference is the treatment of the start and end nodes. For trapezoidal their corresponding bins end exactly at the nodes, while for rectangular they extend further out by the half distance to the neighbor node (but not beyond 0). Attempts to check that the size grids and scat_data represent the bulk extinction sufficiently. Specifically, it is tested that (a) psd*ext is decreasing at the small and large particle size ends of the size grid - but only if scattering species bulk extinction exceeds 1% of *threshold_ss_ext*. (b) removing the smallest and largest particles changes the resulting bulk extinction by less then a fraction of *threshold_se_ext* - but only if scattering species bulk extinction exceeds *threshold_ss_ext* and number density (pnd) of the edge size point at this atmospheric level is larger than *threshold_se_pnd* times the maximum pnd of this scattering element over all atmospheric levels. Skipping tests in case of low extinction is done in order to minimize issues arising from very low mass densities, particularly at single atmospheric levels, and very low bulk extinctions, i.e. in cases where the effects on the radiance fields are estimated to be low. NOTE: The tests are only approximate and do not guarantee the validity of the resulting bulk properties (and increasing the thresholds will decrease the reliability of the bulk properties).

**Authors: **Jana Mendrok, Patrick Eriksson

### Synopsis

pndFromPsd( | pnd_data, dpnd_data_dx, pnd_size_grid, psd_data, psd_size_grid, dpsd_data_dx, scat_data, f_grid, scat_data_checked, quad_order, scat_index, threshold_se_ext, threshold_ss_ext, threshold_se_pnd ) |

### Variables

OUT | pnd_data | (Matrix) | Particle number density values for a set of points. |

OUT | dpnd_data_dx | (Tensor3) | Partial derivates of pnd_data. |

IN | pnd_size_grid | (Vector) | The particle sizes associated with pnd_data. |

IN | psd_data | (Matrix) | Particle size distribution values for a set of points. |

IN | psd_size_grid | (Vector) | The particle sizes associated with psd_data. |

IN | dpsd_data_dx | (Tensor3) | Partial derivates of psd_data. |

IN | scat_data | (ArrayOfArrayOfSingleScatteringData) | Array of single scattering data. |

IN | f_grid | (Vector) | The frequency grid for monochromatic pencil beam calculations. |

IN | scat_data_checked | (Index) | OK-flag for scat_data. |

GIN | quad_order | (Index, Default: 1) | Order of bin quadrature. |

GIN | scat_index | (Index) | Take data from scattering species of this index (0-based) in scat_data. |

GIN | threshold_se_ext | (Numeric, Default: 0.02) | Maximum allowed extinction fraction in each of the edge size bins. |

GIN | threshold_ss_ext | (Numeric, Default: 1e-8) | Minimum bulk extinction in the processed scattering species for which to apply size grid representation checks. |

GIN | threshold_se_pnd | (Numeric, Default: 0.02) | Minimum ratio of edge point pnd to maximum pnd of this scattering element over all pressure levels. |