pqf_module.f90 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. ! First include the set of model-wide compiler flags
  2. #include "tm5.inc"
  3. ! -----------------------------------------------------------------------------
  4. !
  5. ! TROPOMI L2 Data Processors
  6. !
  7. ! Copyright 2013 - 2015 KNMI, DLR, RAL, ESA
  8. ! All rights Reserved
  9. !
  10. ! This is a generated file (created at 2015-10-06T11:11:17.001955)
  11. !
  12. !> \file pqf_module.f90
  13. !! Module file for the list of processing quality flags.
  14. !> Module for the list of processing quality flags.
  15. !!
  16. !! This module contains a list of all the processing quality flags, including those that
  17. !! cannot occur in this specific algorithm. The values of these processing quality flags
  18. !! is the same for all algorithms of S5P. Values given as a power of 2 are warning flags,
  19. !! which means that they can co-exist with other flags.
  20. !!
  21. !! Note that this module must be compiled with ``-fno-range-check'', for the PQF_WARNING_MASK
  22. !! constant.
  23. ! S = pixel contains valid retrieval data
  24. ! W = pixel contains retrieval data but should be used with care
  25. ! E = pixel does not contain retrieval data (with partial exceptions in CO).
  26. ! -----------------------------------------------------------------------------
  27. module pqf_module
  28. implicit none
  29. ! Masks for general qualification of PQF values
  30. integer, parameter :: PQF_ERROR_MASK = Z'000000FF' !< Mask to select only errors.
  31. integer, parameter :: PQF_WARNING_MASK = Z'7FFFFF00' !< Mask to select only warnings
  32. integer, parameter :: PQF_MAX_NUMBER_OF_WARNINGS = 24 !< Maximum number of warning flags
  33. integer, parameter :: PQF_CURRENT_NUMBER_OF_WARNINGS = 18 !< Current number of defined warnings
  34. integer, parameter :: PQF_FILTER_MASK = Z'000000C0' !< Maks to select filters.
  35. ! Processing failures and filter conditions
  36. integer, parameter :: PQF_S_SUCCESS = Z'00000000' !< No failures, output contains value. Warnings still possible.
  37. integer, parameter :: PQF_E_RADIANCE_MISSING = Z'00000001' !< The number of spectral pixels in the radiance due to flagging is too small to perform the fitting.
  38. integer, parameter :: PQF_E_IRRADIANCE_MISSING = Z'00000002' !< The number of spectral pixels in the irradiance due to flagging is too small to perform the fitting.
  39. integer, parameter :: PQF_E_INPUT_SPECTRUM_MISSING = Z'00000003' !< The reflectance spectrum does not contain enough points to perform the retrieval. This is different from (ir)radiance\_missing in that the missing points may not be aligned.
  40. integer, parameter :: PQF_E_REFLECTANCE_RANGE_ERROR = Z'00000004' !< Any of the reflectances is out of bounds ($R<0$ or $R> R_{\text{max}}$).
  41. integer, parameter :: PQF_E_LER_RANGE_ERROR = Z'00000005' !< Lambert-equivalent reflectivity out of range error.
  42. integer, parameter :: PQF_E_SNR_RANGE_ERROR = Z'00000006' !< Too low signal to noise to perform retrieval.
  43. integer, parameter :: PQF_E_SZA_RANGE_ERROR = Z'00000007' !< Solar zenith angle out of range, maximum value from configuration.
  44. integer, parameter :: PQF_E_VZA_RANGE_ERROR = Z'00000008' !< Viewing zenith angle out of range, maximum value from configuration.
  45. integer, parameter :: PQF_E_LUT_RANGE_ERROR = Z'00000009' !< Extrapolation in lookup table (airmass factor, cloud radiances).
  46. integer, parameter :: PQF_E_OZONE_RANGE_ERROR = Z'0000000A' !< Ozone column significantly out of range of profile climatology.
  47. integer, parameter :: PQF_E_WAVELENGTH_OFFSET_ERROR = Z'0000000B' !< Wavelength offset exceeds maximum from configuration.
  48. integer, parameter :: PQF_E_INITIALIZATION_ERROR = Z'0000000C' !< An error occurred during the processing of the pixel, no output was generated. The following errors raise this flag: Mismatch between irradiance and radiance wavelengths; The on-ground distance between band 1 and band 2 ground pixels exceeds a threshold set in the configuration. Derived a-priori information does not validate, no processing is possible.
  49. integer, parameter :: PQF_E_MEMORY_ERROR = Z'0000000D' !< Memory allocation or deallocation error.
  50. integer, parameter :: PQF_E_ASSERTION_ERROR = Z'0000000E' !< Error in algorithm detected during assertion.
  51. integer, parameter :: PQF_E_IO_ERROR = Z'0000000F' !< Error detected during transfer of data between algorithm and framework.
  52. integer, parameter :: PQF_E_NUMERICAL_ERROR = Z'00000010' !< General fatal numerical error occurred during inversion.
  53. integer, parameter :: PQF_E_LUT_ERROR = Z'00000011' !< Error in accessing the lookup table.
  54. integer, parameter :: PQF_E_ISRF_ERROR = Z'00000012' !< Error detected in the input instrument spectral response function input data.
  55. integer, parameter :: PQF_E_CONVERGENCE_ERROR = Z'00000013' !< The main algorithm did not converge.
  56. integer, parameter :: PQF_E_CLOUD_FILTER_CONVERGENCE_ERROR = Z'00000014' !< The cloud filter did not converge.
  57. integer, parameter :: PQF_E_MAX_ITERATION_CONVERGENCE_ERROR = Z'00000015' !< No convergence because retrieval exceeds maximum number of iterations. Maximum value from configuration.
  58. integer, parameter :: PQF_E_AOT_LOWER_BOUNDARY_CONVERGENCE_ERROR = Z'00000016' !< No convergence because the aerosol optical thickness crosses lower boundary twice in succession.
  59. integer, parameter :: PQF_E_OTHER_BOUNDARY_CONVERGENCE_ERROR = Z'00000017' !< No convergence because a state vector element crosses boundary twice in succession. Note that a separate failure flag is defined for non-convergence due to crossing of lower AOT boundary.
  60. integer, parameter :: PQF_E_GEOLOCATION_ERROR = Z'00000018' !< Geolocation out of range.
  61. integer, parameter :: PQF_E_CH4_NOSCAT_ZERO_ERROR = Z'00000019' !< The \Methane column retrieved by the non-scattering \Carbonmonoxide algorithm from the weak band or strong band is 0.
  62. integer, parameter :: PQF_E_H2O_NOSCAT_ZERO_ERROR = Z'0000001A' !< The \Water column retrieved by the non-scattering \Carbonmonoxide algorithm from the weak band or strong band is 0.
  63. integer, parameter :: PQF_E_MAX_OPTICAL_THICKNESS_ERROR = Z'0000001B' !< Maximum optical thickness exceeded during iterations.
  64. integer, parameter :: PQF_E_AEROSOL_BOUNDARY_ERROR = Z'0000001C' !< Boundary hit of aerosol parameters at last iteration.
  65. integer, parameter :: PQF_E_BOUNDARY_HIT_ERROR = Z'0000001D' !< Fatal boundary hit during iterations.
  66. integer, parameter :: PQF_E_CHI2_ERROR = Z'0000001E' !< $\chi^2$ is not-a-number or larger than $10^{10}$.
  67. integer, parameter :: PQF_E_SVD_ERROR = Z'0000001F' !< Singular value decomposition failure.
  68. integer, parameter :: PQF_E_DFS_ERROR = Z'00000020' !< Degree of freedom is not-a-number.
  69. integer, parameter :: PQF_E_RADIATIVE_TRANSFER_ERROR = Z'00000021' !< Errors occurred during the radiative transfer computations, no processing possible.
  70. integer, parameter :: PQF_E_OPTIMAL_ESTIMATION_ERROR = Z'00000022' !< Errors occurred during the optimal estimation, processing has been terminated.
  71. integer, parameter :: PQF_E_PROFILE_ERROR = Z'00000023' !< Flag that indicates if there were any errors during the computation of the ozone profile.
  72. integer, parameter :: PQF_E_CLOUD_ERROR = Z'00000024' !< No cloud data.
  73. integer, parameter :: PQF_E_MODEL_ERROR = Z'00000025' !< Forward model failure.
  74. integer, parameter :: PQF_E_NUMBER_OF_INPUT_DATA_POINTS_TOO_LOW_ERROR = Z'00000026' !< Not enough input ozone columns to calculate a tropospheric column.
  75. integer, parameter :: PQF_E_CLOUD_PRESSURE_SPREAD_TOO_LOW_ERROR = Z'00000027' !< Cloud pressure variability to low to estimate a tropospheric column.
  76. integer, parameter :: PQF_E_CLOUD_TOO_LOW_LEVEL_ERROR = Z'00000028' !< Clouds are too low in the atmosphere to assume sufficient shielding.
  77. integer, parameter :: PQF_E_GENERIC_RANGE_ERROR = Z'00000029' !< Generic range error.
  78. integer, parameter :: PQF_E_GENERIC_EXCEPTION = Z'0000002A' !< Catch all generic error.
  79. integer, parameter :: PQF_E_INPUT_SPECTRUM_ALIGNMENT_ERROR = Z'0000002B' !< Input radiance and irradiance spectra are not aligned correctly.
  80. integer, parameter :: PQF_E_ABORT_ERROR = Z'0000002C' !< Not processed because processor aborted prematurely (time out or user abort)
  81. integer, parameter :: PQF_E_WRONG_INPUT_TYPE_ERROR = Z'0000002D' !< Wrong input type error, mismatch between expectation and received data.
  82. integer, parameter :: PQF_E_WAVELENGTH_CALIBRATION_ERROR = Z'0000002E' !< An error occurred in the wavelength calibration of this pixel
  83. integer, parameter :: PQF_E_COREGISTRATION_ERROR = Z'0000002F' !< No colocated pixels found in a supporting band
  84. integer, parameter :: PQF_F_SOLAR_ECLIPSE_FILTER = Z'00000040' !< Solar eclipse.
  85. integer, parameter :: PQF_F_CLOUD_FILTER = Z'00000041' !< The cloud filter triggered causing the pixel to be skipped.
  86. integer, parameter :: PQF_F_ALTITUDE_CONSISTENCY_FILTER = Z'00000042' !< Too large difference between ECMWF altitude and DEM altitude value.
  87. integer, parameter :: PQF_F_ALTITUDE_ROUGHNESS_FILTER = Z'00000043' !< Too large standard deviation of altitude in DEM.
  88. integer, parameter :: PQF_F_SUN_GLINT_FILTER = Z'00000044' !< For pixels over water, viewing direction inside sun glint region. Definition of sun glint angle and threshold value from ATBD.
  89. integer, parameter :: PQF_F_MIXED_SURFACE_TYPE_FILTER = Z'00000045' !< Pixel contains land and water areas (e.g. coastal pixel).
  90. integer, parameter :: PQF_F_SNOW_ICE_FILTER = Z'00000046' !< Pixel contains snow/ice: Snow/ice flag according to dynamic input OR climatological surface albedo at VIS wavelength is larger than 0.5.
  91. integer, parameter :: PQF_F_AAI_FILTER = Z'00000047' !< AAI smaller than 2.0.
  92. integer, parameter :: PQF_F_CLOUD_FRACTION_FRESCO_FILTER = Z'00000048' !< Pixel contains clouds: The FRESCO effective cloud fraction is larger than threshold. Threshold value from ATBD.
  93. integer, parameter :: PQF_F_AAI_SCENE_ALBEDO_FILTER = Z'00000049' !< Pixel contains clouds: The difference between scene albedo at 380 nm from AAI calculation and the climatologcal surface albedo exceeds threshold. Threshold value from ATBD. This test filters out clouds.
  94. integer, parameter :: PQF_F_SMALL_PIXEL_RADIANCE_STD_FILTER = Z'0000004A' !< Pixel contains clouds: Standard deviation of radiances in small-pixel column exceeds threshold. Threshold value from ATBD.
  95. integer, parameter :: PQF_F_CLOUD_FRACTION_VIIRS_FILTER = Z'0000004B' !< Pixel contains clouds: The cloud fraction from VIIRS / NPP exceeds theshold. Threshold value from ATBD.
  96. integer, parameter :: PQF_F_CIRRUS_REFLECTANCE_VIIRS_FILTER = Z'0000004C' !< Pixel contains clouds: Cirrus reflectance from VIIRS / NPP exceeds threshold. Threshold value from ATBD.
  97. integer, parameter :: PQF_F_CF_VIIRS_SWIR_IFOV_FILTER = Z'0000004D' !< Fraction of cloudy VIIRS pixels wihtin S5P SWIR ground pixel exceeds a priori threshold from configuration.
  98. integer, parameter :: PQF_F_CF_VIIRS_SWIR_OFOVA_FILTER = Z'0000004E' !< Fraction of cloudy VIIRS pixels wihtin S5P SWIR OFOVa exceeds a priori threshold from configuration.
  99. integer, parameter :: PQF_F_CF_VIIRS_SWIR_OFOVB_FILTER = Z'0000004F' !< Fraction of cloudy VIIRS pixels wihtin S5P SWIR OFOVb exceeds a priori threshold from configuration.
  100. integer, parameter :: PQF_F_CF_VIIRS_SWIR_OFOVC_FILTER = Z'00000050' !< Fraction of cloudy VIIRS pixels wihtin S5P SWIR OFOVc exceeds a priori threshold from configuration.
  101. integer, parameter :: PQF_F_CF_VIIRS_NIR_IFOV_FILTER = Z'00000051' !< Fraction of cloudy VIIRS pixels wihtin S5P NIR ground pixel exceeds a priori threshold from configuration.
  102. integer, parameter :: PQF_F_CF_VIIRS_NIR_OFOVA_FILTER = Z'00000052' !< Fraction of cloudy VIIRS pixels wihtin S5P NIR OFOVa exceeds a priori threshold from configuration.
  103. integer, parameter :: PQF_F_CF_VIIRS_NIR_OFOVB_FILTER = Z'00000053' !< Fraction of cloudy VIIRS pixels wihtin S5P NIR OFOVb exceeds a priori threshold from configuration.
  104. integer, parameter :: PQF_F_CF_VIIRS_NIR_OFOVC_FILTER = Z'00000054' !< Fraction of cloudy VIIRS pixels wihtin S5P NIR OFOVc exceeds a priori threshold from configuration.
  105. integer, parameter :: PQF_F_REFL_CIRRUS_VIIRS_SWIR_FILTER = Z'00000055' !< Average VIIRS cirrus reflectance within SWIR ground pixel exceeds a priori threshold from configuration.
  106. integer, parameter :: PQF_F_REFL_CIRRUS_VIIRS_NIR_FILTER = Z'00000056' !< Average VIIRS cirrus reflectance within NIR ground pixel exceeds a priori threshold from configuration.
  107. integer, parameter :: PQF_F_DIFF_REFL_CIRRUS_VIIRS_FILTER = Z'00000057' !< Difference in VIIRS average cirrus reflectance between SWIR and NIR ground pixel exceeds a priori threshold from configuration.
  108. integer, parameter :: PQF_F_CH4_NOSCAT_RATIO_FILTER = Z'00000058' !< The ratio between [\Methane]$_{\text{weak}}$ and [\Methane]$_{\text{strong}}$ is below or exceeds a priori thresholds from configuration.
  109. integer, parameter :: PQF_F_CH4_NOSCAT_RATIO_STD_FILTER = Z'00000059' !< The standard deviation of [\Methane]$_{\text{weak}}$/[\Methane]$_{\text{strong}}$ within the SWIR pixel and the 8 neighbouring pixels exceeds a priori threshold from configuration.
  110. integer, parameter :: PQF_F_H2O_NOSCAT_RATIO_FILTER = Z'0000005A' !< The ratio between [\Water]$_{\text{weak}}$ and [\Water]$_{\text{strong}}$ is below or exceeds a priori thresholds from configuration.
  111. integer, parameter :: PQF_F_H2O_NOSCAT_RATIO_STD_FILTER = Z'0000005B' !< The standard deviation of [\Water]$_{\text{weak}}$/[\Water]$_{\text{strong}}$ within the SWIR pixel and the 8 neigbouring pixels exceeds a priori threshold from configuration.
  112. integer, parameter :: PQF_F_DIFF_PSURF_FRESCO_ECMWF_FILTER = Z'0000005C' !< Difference between the FRESCO apparent surface pressure and the ECMWF surface pressure exceeds a priori threshold from configuration.
  113. integer, parameter :: PQF_F_PSURF_FRESCO_STDV_FILTER = Z'0000005D' !< The standard deviation of the FRESCO apparent surface pressure in the NIR pixel and the 8 surrounding pixels exceeds a priori threshold from configuration.
  114. integer, parameter :: PQF_F_OCEAN_FILTER = Z'0000005E' !< The ground pixel is over ocean (and ocean glint retrievals are not switched on).
  115. integer, parameter :: PQF_F_TIME_RANGE_FILTER = Z'0000005F' !< Time is out of the range that is to be processed.
  116. integer, parameter :: PQF_F_PIXEL_OR_SCANLINE_INDEX_FILTER = Z'00000060' !< Not processed because pixel index does not match general selection criteria.
  117. integer, parameter :: PQF_F_GEOGRAPHIC_REGION_FILTER = Z'00000061' !< Pixel falls outside the specified regions of interest.
  118. ! Processing warnings
  119. integer, parameter :: PQF_W_INPUT_SPECTRUM_WARNING = Z'00000100' !< Number of good pixels in radiance, irradiance or calculated reflectance below threshold from configuration.
  120. integer, parameter :: PQF_W_WAVELENGTH_CALIBRATION_WARNING = Z'00000200' !< Offset from wavelength fit is larger than limit set in configuration.
  121. integer, parameter :: PQF_W_EXTRAPOLATION_WARNING = Z'00000400' !< Pressure or temperature outside cross section LUT range, other lookup table extrapolation.
  122. integer, parameter :: PQF_W_SUN_GLINT_WARNING = Z'00000800' !< Sun glint posibility warning.
  123. integer, parameter :: PQF_W_SOUTH_ATLANTIC_ANOMALY_WARNING = Z'00001000' !< TROPOMI is inside the south Atlantic anomaly while taking these measurements.
  124. integer, parameter :: PQF_W_SUN_GLINT_CORRECTION = Z'00002000' !< A sun glint correction has been applied.
  125. integer, parameter :: PQF_W_SNOW_ICE_WARNING = Z'00004000' !< Snow/ice flag is set, i.e. using scene data from the cloud support product.
  126. integer, parameter :: PQF_W_CLOUD_WARNING = Z'00008000' !< Cloud filter based on FRESCO apparent surface pressure (VIIRS not available), cloud fraction above threshold or cloud pressure adjusted to force cloud above surface.
  127. integer, parameter :: PQF_W_AAI_WARNING = Z'00010000' !< Possible aerosol contamination as indicated by the AAI.
  128. integer, parameter :: PQF_W_PIXEL_LEVEL_INPUT_DATA_MISSING = Z'00020000' !< Dynamic auxiliary input data (e.g.. cloud) is missing for this ground pixel. A fallback option is used.
  129. integer, parameter :: PQF_W_DATA_RANGE_WARNING = Z'00040000' !< Carbon monoxide column tends to negative values; Water column tends to negative values; Heavy water (HDO) column tends to negative values; others.
  130. integer, parameter :: PQF_W_LOW_CLOUD_FRACTION_WARNING = Z'00080000' !< Low cloud fraction, therefore no cloud pressure retrieved.
  131. integer, parameter :: PQF_W_ALTITUDE_CONSISTENCY_WARNING = Z'00100000' !< Difference between ECMWF surface elevation and high-resolution surface elevation exceeds threshold from configuration.
  132. integer, parameter :: PQF_W_SIGNAL_TO_NOISE_RATIO_WARNING = Z'00200000' !< Signal to noise ratio in SWIR and/or NIR band below threshold from configuration.
  133. integer, parameter :: PQF_W_DECONVOLUTION_WARNING = Z'00400000' !< Failed deconvolution irradiance spectrum (not pixel-specific, but row-specific).
  134. integer, parameter :: PQF_W_SO2_VOLCANIC_ORIGIN_LIKELY_WARNING = Z'00800000' !< Warning for \Sulphurdioxide BL product, UTLS products: volcanic origin except for heavily polluted sites.
  135. integer, parameter :: PQF_W_SO2_VOLCANIC_ORIGIN_CERTAIN_WARNING = Z'01000000' !< Warning for \Sulphurdioxide BL product, UTLS products: volcanic origin certain.
  136. integer, parameter :: PQF_W_INTERPOLATION_WARNING = Z'02000000' !< Warning for interpolation on partially missing data. In this case the valid available data is used, potentially leading to a bias.
  137. end module pqf_module