{"id":393,"date":"2023-08-03T17:52:03","date_gmt":"2023-08-03T17:52:03","guid":{"rendered":"https:\/\/itwg.ssec.wisc.edu\/rtsp\/?page_id=393"},"modified":"2023-08-03T17:52:03","modified_gmt":"2023-08-03T17:52:03","slug":"level-layer-conversion","status":"publish","type":"page","link":"https:\/\/itwg.ssec.wisc.edu\/rtsp\/level-layer-conversion\/","title":{"rendered":"Level Layer Conversion"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">EFFECTIVE_LAYER_TP<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"> NAME:\n       Effective_Layer_TP\n\n PURPOSE:\n       Function to calculate the effective atmospheric layer temperature and\n       pressure by weighting level values with the integrated layer density.\n\n CALLING SEQUENCE:\n       Error_Status = Effective_Layer_TP( Height,                 &amp;  ! Input\n                                          Pressure,               &amp;  ! Input\n                                          Temperature,            &amp;  ! Input\n                                          Water_Vapor_Pressure,   &amp;  ! Input\n                                          Effective_Pressure,     &amp;  ! Output\n                                          Effective_Temperature,  &amp;  ! Output\n                                          RCS_Id     =RCS_Id,     &amp;  ! Revision control\n                                          Message_Log=Message_Log )  ! Error messaging\n\n INPUT ARGUMENTS:\n       Height:                 Heights of the atmospheric levels.\n                               UNITS:      metres, m\n                               TYPE:       REAL(fp)\n                               DIMENSION:  Rank-1 (N x 1, where N&gt;1)\n                               ATTRIBUTES: INTENT(IN)\n\n       Pressure:               Pressure of the atmospheric levels.\n                               UNITS:      hectoPascals, hPa\n                               TYPE:       REAL(fp)\n                               DIMENSION:  Same as Height\n                               ATTRIBUTES: INTENT(IN)\n\n       Temperature:            Temperature of the atmospheric levels.\n                               UNITS:      Kelvin, K\n                               TYPE:       REAL(fp)\n                               DIMENSION:  Same as Height\n                               ATTRIBUTES: INTENT(IN)\n\n       Water_Vapor_Pressure:   Water vapor partial pressure at the atmospheric levels\n                               UNITS:      hectoPascals, hPa\n                               TYPE:       REAL(fp)\n                               DIMENSION:  Same as Height\n                               ATTRIBUTES: INTENT(IN)\n\n OPTIONAL INPUT ARGUMENTS:\n       Message_Log:            Character string specifying a filename in which any\n                               Messages will be logged. If not specified, or if an\n                               error occurs opening the log file, the default action\n                               is to output Messages to standard output.\n                               UNITS:      N\/A\n                               TYPE:       CHARACTER(*)\n                               DIMENSION:  Scalar\n                               ATTRIBUTES: INTENT(IN), OPTIONAL\n\n OUTPUT ARGUMENTS:\n       Effective_Pressure:     Effective layer pressure.\n                               UNITS:      hectoPascals, hPa\n                               TYPE:       REAL(fp)\n                               DIMENSION:  Rank-1 (N-1 x 1)\n                               ATTRIBUTES: INTENT(OUT)\n\n       Effective_Temperature:  Effective layer temperature.\n                               UNITS:      Kelvin, K\n                               TYPE:       REAL(fp)\n                               DIMENSION:  Same as Effective_Pressure\n                               ATTRIBUTES: INTENT(OUT)\n\n\n OPTIONAL OUTPUT ARGUMENTS:\n       RCS_Id:                 Character string containing the Revision Control\n                               System Id field for the module.\n                               UNITS:      N\/A\n                               TYPE:       CHARACTER(*)\n                               DIMENSION:  Scalar\n                               ATTRIBUTES: INTENT(OUT), OPTIONAL\n\n FUNCTION RESULT:\n       Error_Status:           The return value is an integer defining the error status.\n                               The error codes are defined in the ERROR_HANDLER module.\n                               If == SUCCESS the calculation was successful\n                                  == FAILURE an unrecoverable error occurred\n                               UNITS:      N\/A\n                               TYPE:       INTEGER\n                               DIMENSION:  Scalar\n\n PROCEDURE:\n       Based on:\n\n       Gallery, W.O., F.X. Kneizys, and S.A. Clough, \"Air mass computer\n         program for atmospheric transmittance\/radiance calculation: FSCATM\",\n         AFGL-TR-83-0065, 9 March 1983.\n\n       The effective pressure and temperature is defined as,\n               __\n              \\           \n               &gt;  p.rho.dz\n              \/__         \n         _\n         p = -----------------     ..............................................(1)\n                 __\n                \\         \n                 &gt;  rho.dz\n                \/__       \n\n       and\n\n               __\n              \\           \n               &gt;  T.rho.dz\n              \/__         \n         _\n         T = -----------------     ..............................................(2)\n                 __\n                \\         \n                 &gt;  rho.dz\n                \/__\n\n       where dz == layer thickness.\n\n       Note that the denominators of eqns(1) and (2) can also be referred to as the\n       column density.\n\n       The pressure and total density are both assumed to follow an exponential\n       profile with scale heights H_p and H_rho respectively. For a single layer\n       the numerator of eqn(1) can be written as,\n\n          __ k\n         \\                H_p.H_rho\n          &gt;  p.rho.dz = ------------- ( p(k-1).rho(k-1) - p(k).rho(k) )     .....(3)\n         \/__             H_p + H_rho\n            k-1\n\n       Similarly for the numerator of eqn(2) using the ideal gas law,\n       p = R_air.rho.T, we get\n\n          __ k\n         \\                H_p\n          &gt;  T.rho.dz = -------( p(l-1) - p(l) )     ............................(4)\n         \/__             R_air\n            k-1\n\n       and the denominator is given by,\n\n          __ k\n         \\           \n          &gt;  rho.dz = H_rho ( rho(l-1) - rho(l) )     ...........................(5)\n         \/__         \n            k-1\n\n       where the scale heights are defined as,\n\n                -( z(l) - z(l-1 ) )        \n         H_p = ---------------------     ........................................(6)\n                ln( p(l) \/ p(l-1) )        \n\n       and\n\n                    -( z(l) - z(l-1 ) )\n         H_rho = -------------------------     ..................................(7)\n                  ln( rho(l) \/ rho(l-1) )\n\n\n       Note that in eqn.(4) the gas constant is that for *air*, not *dry air*. To\n       determine this the effective molecular weight of air (as a function of pressure)\n       must be determined.\n\n       Breaking down the units of the components, \n\n         units(p)  = hPa\n                   = 100 Pa\n                   = 100 N.m^-2\n                   = 100 kg.m.s^-2.m^-2\n                   = 100 kg.m^-1.s^-2\n\n                          m2\n         units(eqn(3)) = ----( 100 kg.m^-1.s^-2  .  kg.m^-3 )\n                          m \n\n                       = 100 kg^2.m^-3.s^-2\n\n                          m  . 100 kg.m^-1.s^-2\n         units(eqn(4)) = -----------------------\n                              J.g^-1.K^-1\n\n                          m  . 100 kg.m^-1.s^-2\n                       = ------------------------\n                           kg.m^2.s^-2.g^-1.K^-1\n\n                       = 100 K.g.m^-2\n                       = 0.1 K.kg.m^-2\n\n         units(eqn(5)) = m  .  kg.m^-3\n                       = kg.m^-2  \n                     \n       So the units of the final equations are:\n\n               _     units(eqn(3))\n         units(p) = ---------------\n                     units(eqn(5))  \n\n                          100 kg^2.m^-3.s^-2\n                  = --------------------\n                         kg.m^-2  \n\n                  = 100 kg.m^-1.s^-2\n                  = 100 kg.m.s^-2.m^-2\n                  = 100 N.m^-2\n                  = 100 Pa\n                  = hPa\n\n               _     units(eqn(4))\n         units(T) = ---------------\n                     units(eqn(5))  \n\n                     0.1 K.kg.m^-2\n                  = ---------------\n                       kg.m^-2  \n\n                  = 0.1 K\n\n       So the final temperatures must be multiplied by 0.1 to get units of K.\n\n       Note for the above units breakdown of eqn(4) that the gas constant\n       for air is computed in units of J.g^-1.K^-1, *NOT* the SI units of\n       J.kg^-1.K^-1. This is done solely to save the conversion operation\n       of g-&gt;kg for each loop iteration. Otherwise, for a gas constant in\n       units of J.kg^-1.K^-1, the final scaling factor for the effective\n       temperature would be 100, not 0.1.\n\n CREATION HISTORY:\n       Written by:     Paul van Delst, CIMSS\/SSEC, 03-May-2000\n                       paul.vandelst@ssec.wisc.edu\n<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">CREATE_SUBLEVELS<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"> NAME:\n       Create_Sublevels\n\n PURPOSE:\n       Function to create the sublevels used to integrate input profiles\n       to obtain average layer quantities. This routine is called before\n       Integrate_Sublevels.\n\n       Adapted from the UMBC INTLEV.F function supplied with the AIRS RTA.\n\n CALLING SEQUENCE:\n       Error_Status = Create_Sublevels( Level_Pressure,         &amp;  ! Input\n                                        Level_Temperature,      &amp;  ! Input\n                                        Level_Absorber,         &amp;  ! Input\n                                        n_Per_Layer,            &amp;  ! Input\n                                        Sublevel_Pressure,      &amp;  ! Output\n                                        Sublevel_Temperature,   &amp;  ! Output\n                                        Sublevel_Absorber,      &amp;  ! Output\n                                        RCS_Id     =RCS_Id,     &amp;  ! Revision control\n                                        Message_Log=Message_Log )  ! Error messaging\n\n INPUT ARGUMENTS:\n       Level_Pressure:        Pressure of the atmospheric levels.\n                              UNITS:      hectoPascals, hPa\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Rank-1 (K)\n                                            K == number of levels\n                              ATTRIBUTES: INTENT(IN)\n\n       Level_Temperature:     Temperature of the atmospheric levels.\n                              UNITS:      Kelvin, K\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Same as Level_Pressure\n                              ATTRIBUTES: INTENT(IN)\n\n       Level_Absorber:        Absorber concentrations at the atmospheric levels\n                              UNITS:      Doesn't matter - as long as they are\n                                          LEVEL specific.\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Rank-2 (K x J)\n                                            K == number of levels\n                                            J == number of absorbers\n                              ATTRIBUTES: INTENT(IN)\n\n       n_Per_Layer:           Number of sublevels to create in each layer.\n                              Value must be &gt; or = 1.\n                              UNITS:      N\/A\n                              TYPE:       INTEGER\n                              DIMENSION:  Scalar\n                              ATTRIBUTES: INTENT(IN)\n\n\n OPTIONAL INPUT ARGUMENTS:\n       Message_Log:           Character string specifying a filename\n                              in which any Messages will be logged.\n                              If not specified, or if an error occurs\n                              opening the log file, the default action\n                              is to output Messages to standard output.\n                              UNITS:      N\/A\n                              TYPE:       CHARACTER(*)\n                              DIMENSION:  Scalar\n                              ATTRIBUTES: INTENT(IN), OPTIONAL\n\n OUTPUT ARGUMENTS:\n       Sublevel_Pressure:     Pressure of the atmospheric sublevels.\n                              UNITS:      hectoPascals, hPa\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Rank-1 (Ks)\n                                            Ks == number of sublevels\n                                               == ( (K-1) * n_Per_Layer ) + 1\n                              ATTRIBUTES: INTENT(IN)\n\n       Sublevel_Temperature:  Temperature of the atmospheric sublevels.\n                              UNITS:      Kelvin, K\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Same as output Sublevel_Pressure argument\n                              ATTRIBUTES: INTENT(IN)\n\n       Sublevel_Absorber:     Absorber concentrations at the atmospheric Levels\n                              UNITS:      Same as input\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Rank-2 (Ks x J)\n                                            Ks == number of sublevels\n                                            J  == number of absorbers\n                              ATTRIBUTES: INTENT(IN)\n\n\n OPTIONAL OUTPUT ARGUMENTS:\n       RCS_Id:                Character string containing the Revision Control\n                              System Id field for the module.\n                              UNITS:      N\/A\n                              TYPE:       CHARACTER(*)\n                              DIMENSION:  Scalar\n                              ATTRIBUTES: INTENT(OUT), OPTIONAL\n\n FUNCTION RESULT:\n       Error_Status:          The return value is an integer defining the error\n                              status. The error codes are defined in the\n                              ERROR_HANDLER module.\n                              If == SUCCESS the calculation was successful\n                                 == FAILURE an unrecoverable error occurred\n                              UNITS:      N\/A\n                              TYPE:       INTEGER\n                              DIMENSION:  Scalar\n\n PROCEDURE:\n       The assumption is made that temperature and absorber amount vary\n       linearly with ln(p). To improve the quadrature in integrating Level\n       amounts to a layer value, each input layer, k, is split into N(k)\n       sublayers equally spaced in ln(p),\n\n                                 ln(p[k+1]) - ln(p[k]\n         ln(p[n+1]) - ln(p[n] = ---------------------\n                                          N(k)\n\n       given the pressures, p(1) - p(K) of the input Levels.\n\n       Once the sublevels are defined, the level temperatures and absorber\n       amounts are linearly interpolated at the specific number of sublevels\n       and those interpolates are associated with the sublevel pressures.\n\n       The last corresponding level\/sublevel is assigned explicitly.\n\n       Currently, N is independent of k. That is, the same number of sublevels\n       are created for each layer.\n\n CREATION HISTORY:\n       Written by:     Paul van Delst, CIMSS\/SSEC 19-Jan-2001\n                       paul.vandelst@ssec.wisc.edu\n<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">INTEGRATE_SUBLEVELS<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"> NAME:\n       Integrate_Sublevels\n\n PURPOSE:\n       Function to integrate the sublevel values created by Create_Sublevels\n       to provide average layer temperature and absorber amount. Layer\n       pressure is provided by default, i.e. not from integration.\n\n       Adapted from the UMBC INTEG.F function supplied with the AIRS RTA.\n\n CALLING SEQUENCE:\n       Error_Status = Integrate_Sublevels( Sublevel_Height,        &amp;  ! Input\n                                           Sublevel_Pressure,      &amp;  ! Input\n                                           Sublevel_Temperature,   &amp;  ! Input\n                                           Sublevel_Absorber,      &amp;  ! Input\n                                           n_Per_Layer,            &amp;  ! Input\n                                           H2O_J_Index,            &amp;  ! Input\n                                           Layer_Pressure,         &amp;  ! Output\n                                           Layer_Temperature,      &amp;  ! Output\n                                           Layer_Absorber,         &amp;  ! Output\n                                           RCS_Id     =RCS_Id,     &amp;  ! Revision control\n                                           Message_Log=Message_Log )  ! Error messaging\n\n INPUT ARGUMENTS:\n       Sublevel_Height:       Altitude of the atmospheric sublevels.\n                              UNITS:      metres, m\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Rank-1 (Ks)\n                                            Ks == number of sublevels\n                              ATTRIBUTES: INTENT(IN)\n\n       Sublevel_Pressure:     Pressure of the atmospheric sublevels.\n                              UNITS:      hectoPascals, hPa\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Same as input Sublevel_Height argument\n                              ATTRIBUTES: INTENT(IN)\n\n       Sublevel_Temperature:  Temperature of the atmospheric sublevels.\n                              UNITS:      Kelvin, K\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Same as input Sublevel_Height argument\n                              ATTRIBUTES: INTENT(IN)\n\n       Sublevel_Absorber:     Absorber concentrations at the atmospheric\n                              sublevels\n                              UNITS:      ppmv\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Rank-2 (Ks x J)\n                                            Ks == number of Sublevels\n                                            J  == number of absorbers\n                              ATTRIBUTES: INTENT(IN)\n\n       n_Per_Layer:           Number of sublevel for each layer.\n                              Value must be &gt; or = 1.\n                              UNITS:      N\/A\n                              TYPE:       INTEGER\n                              DIMENSION:  Scalar\n                              ATTRIBUTES: INTENT(IN)\n\n       H2O_J_Index:           The \"J\" dimension array index position\n                              of water vapor in the input SubLevel_Absorber\n                              array - which is dimensioned Ks x J.\n                              This is necessary to properly convert the\n                              sublevel absorber amounts from ppmv to\n                              kmol.cm^-2.\n                              UNITS:      N\/A\n                              TYPE:       INTEGER\n                              DIMENSION:  Scalar\n                              ATTRIBUTES: INTENT(IN)\n\n OPTIONAL INPUT ARGUMENTS:\n       Message_Log:           Character string specifying a filename\n                              in which any Messages will be logged.\n                              If not specified, or if an error occurs\n                              opening the log file, the default action\n                              is to output Messages to standard output.\n                              UNITS:      N\/A\n                              TYPE:       CHARACTER(*)\n                              DIMENSION:  Scalar\n                              ATTRIBUTES: INTENT(IN), OPTIONAL\n\n OUTPUT ARGUMENTS:\n       Layer_Pressure:        Average pressure of the atmospheric layers\n                              UNITS:      hectoPascals, hPa\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Rank-1 (K-1)\n                                            K-1 == number of layers\n                              ATTRIBUTES: INTENT(IN)\n\n       Layer_Temperature:     Average temperature of the atmospheric layers\n                              UNITS:      Kelvin, K\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Same as output Layer_Pressure argument\n                              ATTRIBUTES: INTENT(IN)\n\n       Layer_Absorber:        Average absorber concentrations of the\n                              atmospheric layers\n                              UNITS:      kmol.cm^-2.\n                              TYPE:       REAL(fp)\n                              DIMENSION:  Rank-2 (K-1 x J)\n                                            K-1 == number of layers\n                                            J   == number of absorbers\n                              ATTRIBUTES: INTENT(IN)\n\n OPTIONAL OUTPUT ARGUMENTS:\n       RCS_Id:                Character string containing the Revision Control\n                              System Id field for the module.\n                              UNITS:      N\/A\n                              TYPE:       CHARACTER(*)\n                              DIMENSION:  Scalar\n                              ATTRIBUTES: INTENT(OUT), OPTIONAL\n\n FUNCTION RESULT:\n       Error_Status:          The return value is an integer defining the error\n                              status. The error codes are defined in the\n                              ERROR_HANDLER module.\n                              If == SUCCESS the calculation was successful\n                                 == FAILURE an unrecoverable error occurred\n                              UNITS:      N\/A\n                              TYPE:       INTEGER\n                              DIMENSION:  Scalar\n\n PROCEDURE:\n       The average layer pressure is simply determined using,\n\n                                 p(k) - p(k-1)\n         Layer_Pressure(k) = --------------------\n                              LOG( p(k)\/p(k-1) )\n\n       The average layer temperature is determined by summing\n       the density weighted layer temperature T.rho subLAYER\n       across the sublayers and normalising by the sum of the\n       subLAYER density,\n\n                               __ N(k)\n                              \\\n                               &gt;   Trho      [ units of kmol.cm^-2.ppmv^-1.K ]\n                              \/__\n                                  1\n         Layer_Temperature = -----------\n                               __ N(k)\n                              \\\n                               &gt;   rho       [ units of kmol.cm^-2.ppmv^-1 ]\n                              \/__\n                                  1\n\n\n                               __ N(k)\n                              \\      1.0e-11\n                               &gt;    --------- * dz * p\n                              \/__       R\n                                  1\n                           = ---------------------------\n                               __ N(k)\n                              \\       1.0e-11\n                               &gt;     --------- * dz * p\n                              \/__      R . T\n                                  1\n\n\n                               __ N(k)\n                              \\\n                               &gt;     dz . p\n                              \/__\n                                  1\n                           = ----------------\n                               __ N(k)\n                              \\      dz . p\n                               &gt;    --------\n                              \/__       T\n                                  1\n\n      in units of Kelvin\n\n      In the UMBC KLAYERS code, the numerator corresponds to the final\n      TSUM value (with each sublayer value corresponding to RJUNK),\n      the denominator to AJUNK, and the result to TLAY.\n\n      The average layer absorber amount is determined by simply summing\n      the sublayer absorber amount across the sublayers,\n\n                          __ N(k)\n                         \\      Trho . ppmv\n        Layer_Absorber =  &gt;    -------------\n                         \/__        T\n                             1\n\n                          __ N(k)\n                         \\      1.0e-11             ppmv\n                       =  &gt;    --------- . dz . p .------\n                         \/__       R                 T\n                             1\n\n       in units of kmol.cm^-2\n\n       This corresponds to ASUM (and eventually ALAY) in the \n       UMBC KLAYERS code.\n\n       Currently, N is independent of k. That is, the same number of sublevels\n       is assumed for each layer.\n\n CREATION HISTORY:\n       Written by:     Paul van Delst, CIMSS\/SSEC 19-Jan-2001\n                       paul.vandelst@ssec.wisc.edu\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>EFFECTIVE_LAYER_TP NAME: Effective_Layer_TP PURPOSE: Function to calculate the effective atmospheric layer temperature and pressure by weighting level values with the integrated layer density. CALLING SEQUENCE: Error_Status = Effective_Layer_TP( Height, &amp; ! Input Pressure, &amp; ! Input Temperature, &amp; ! Input Water_Vapor_Pressure, &amp; ! Input Effective_Pressure, &amp; ! Output Effective_Temperature, &amp; ! Output RCS_Id =RCS_Id, &amp; [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-393","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/itwg.ssec.wisc.edu\/rtsp\/wp-json\/wp\/v2\/pages\/393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itwg.ssec.wisc.edu\/rtsp\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/itwg.ssec.wisc.edu\/rtsp\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/itwg.ssec.wisc.edu\/rtsp\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/itwg.ssec.wisc.edu\/rtsp\/wp-json\/wp\/v2\/comments?post=393"}],"version-history":[{"count":1,"href":"https:\/\/itwg.ssec.wisc.edu\/rtsp\/wp-json\/wp\/v2\/pages\/393\/revisions"}],"predecessor-version":[{"id":394,"href":"https:\/\/itwg.ssec.wisc.edu\/rtsp\/wp-json\/wp\/v2\/pages\/393\/revisions\/394"}],"wp:attachment":[{"href":"https:\/\/itwg.ssec.wisc.edu\/rtsp\/wp-json\/wp\/v2\/media?parent=393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}