The ropp\_fm\_ecmwf\_state2state subroutine maps the state vector x\%state into the state variables x\%temp,  x\%shum, x\%press\_sfc x\%press and x\%geop.

Calculation of full level pressure and geopotential is following

@article{simmons_energy_1981,
        title = {An energy and angular-momentum conserving vertical finite-difference scheme and hybrid vertical coordinates},
        volume = {109},
        journal = {mwr},
        author = {Simmons, A. J. and Burridge, D. M.},
        year = {1981},
        pages = {758--766}
}
equation 3.18.

The ropp\_fm\_ecmwf\_state2state\_tl(x, x\_tl) subroutine propagates a perturbation of the state vector x\_tl\%state to the state variables of x\_tl.  

The ropp\_fm\_ecmwf\_state2state\_ad(x, x\_ad) subroutine propagates a perturbation of the state variables of x\_ad to the adjoint  x\_ad\%state.

Tests:
The t_\fascod\_ecmwf\_tl and t\_fascod\_ecmwf\_ad programs test the ad/tl implementation by mapping a perturbation from state-vector to refractivty space and bending angle space, ie. they test refrac\_1d and bandle\_1d as well as the state2state subroutines.  The TL test only verifies that <f(x+dx)-f(x), f\_tl(dx)>/|f(x+dx)-f(x)| is close to unity when |f(x+dx)-f(x) - f\_tl(dx)|/|f(x+dx)-f(x)| is at minimum. The t\_fascod\_ecmwf\_ad propes the consistency of ad and tl code to $10^-8$ relative difference.


 ./t\_fascod\_ecmwf\_tl
  
 TL: x\%non\_ideal, x\%new\_ref\_op, x\%new\_bangle\_op =  F F F
  
 Checking REFRACTIVITY TL FASCOD_TRO
 |dy|/|dy_init|           cos_angle              100*rel diff
    1.0000000000E+00    7.7748352054E-01    8.9484237172E+01
    1.0000000000E-01    8.7302799306E-01    5.5141499049E+01
    1.0000000000E-02    9.9654791218E-01    8.3651384082E+00
    1.0000000000E-03    9.9995704249E-01    9.2708766520E-01
    1.0000000000E-04    9.9999956976E-01    9.2784559077E-02
    1.0000000000E-05    9.9999999570E-01    9.2792156723E-03
    1.0000000000E-06    9.9999999996E-01    9.2796796506E-04
    1.0000000000E-07    1.0000000000E+00    9.3748021206E-05
    1.0000000000E-08    1.0000000000E+00    7.3099526302E-05
    1.0000000000E-09    9.9999999995E-01    1.0025458375E-03
    1.0000000000E-10    1.0000000000E+00    3.3108763310E-05
    1.0000000000E-11    9.9999999999E-01    3.3880138137E-04
    1.0000000000E-12    9.9999999948E-01    3.3074131786E-03
    1.0000000000E-13    9.9999993327E-01    3.6535174995E-02
    1.0000000000E-14    9.9999234297E-01    3.9197448204E-01
    Refractivity TL check passed
  
 Checking BENDING ANGLE TL FASCOD_TRO
 |dy|/|dy_init|           cos_angle              100*rel diff
    1.0000000000E+00   -9.1670648299E-02    1.0000000007E+02
    1.0000000000E-01   -1.1552789005E-01    1.0000000001E+02
    1.0000000000E-02   -9.8650088270E-02    1.0000000000E+02
    1.0000000000E-03    1.0856024113E-01    9.9999999999E+01
    1.0000000000E-04    9.9267812339E-01    1.2107567411E+01
    1.0000000000E-05    9.9995016445E-01    1.0710929189E+00
    1.0000000000E-06    9.9999949644E-01    1.0757195599E-01
    1.0000000000E-07    9.9999999487E-01    1.0848793386E-02
    1.0000000000E-08    9.9999999970E-01    2.5520329384E-03
    1.0000000000E-09    9.9999999954E-01    3.0514677289E-03
    1.0000000000E-10    9.9999946877E-01    1.0316923792E-01
    1.0000000000E-11    9.9998816478E-01    5.3470767757E-01
    1.0000000000E-12    9.9974796056E-01    2.2597030568E+00
    1.0000000000E-13    9.6657556387E-01    2.6119611187E+01
    1.0000000000E-14    5.7171199596E-01    8.2231672109E+01
    Bending angle TL check passed
****************************
**********  PASS  **********
****************************


 ./t\_fascod\_ecmwf\_ad
  
 AD: x\%non\_ideal, x\%new\_ref\_op, x\%new\_bangle\_op =  F F F
  
 Checking REFRACTIVITY AD FASCOD_TRO
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 =   364528929.066   364528928.849 1.0000000    0.59628E-09
  
 Checking BENDING ANGLE AD FASCOD_TRO
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 =          -9.025          -9.025 1.0000000   -0.36748E-09
  
 Checking REFRACTIVITY AD FASCOD_MLS
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 =   325588949.035   325588948.809 1.0000000    0.69328E-09
  
 Checking BENDING ANGLE AD FASCOD_MLS
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 =          75.279          75.279 1.0000000    0.73677E-09
  
 Checking REFRACTIVITY AD FASCOD_MLW
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 =   431837535.061   431837532.947 1.0000000    0.48936E-08
  
 Checking BENDING ANGLE AD FASCOD_MLW
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 =         -79.704         -79.704 1.0000000   -0.19451E-09
  
 Checking REFRACTIVITY AD FASCOD_SAS
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 =   372208695.410   372208692.403 1.0000000    0.80779E-08
  
 Checking BENDING ANGLE AD FASCOD_SAS
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 =          25.611          25.611 1.0000000   -0.79416E-09
  
 Checking REFRACTIVITY AD FASCOD_SAW
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 =   409038225.382   409038225.287 1.0000000    0.23228E-09
  
 Checking BENDING ANGLE AD FASCOD_SAW
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 =           8.828           8.828 1.0000000   -0.49963E-09
****************************
**********  PASS  **********
****************************

