10 use fckit_configuration_module, 
only: fckit_configuration
 
   11 use fckit_log_module,           
only: fckit_log
 
   35   integer :: isc, iec, jsc, jec, npz
 
   48 subroutine create(self, geom, dummyconf)
 
   52 type(fckit_configuration),       
intent(in)    :: dummyconf
 
   82 integer :: f, jlev, i, j, k
 
   83 character(len=field_clen), 
allocatable :: fields_to_do(:)
 
   84 real(kind=
kind_real), 
pointer :: field_ptr(:,:,:)
 
   92 real(kind=
kind_real), 
allocatable :: rh(:,:,:)         
 
   93 real(kind=
kind_real), 
pointer     :: qsat(:,:,:)        
 
   96 logical :: have_pressures
 
   97 real(kind=
kind_real), 
allocatable :: ps(:,:,:)         
 
   98 real(kind=
kind_real), 
allocatable :: delp(:,:,:)         
 
   99 real(kind=
kind_real), 
allocatable :: prsi(:,:,:)         
 
  100 real(kind=
kind_real), 
allocatable :: prs(:,:,:)         
 
  104 real(kind=
kind_real), 
allocatable :: t(:,:,:)         
 
  105 real(kind=
kind_real), 
pointer     :: pt(:,:,:)         
 
  106 real(kind=
kind_real), 
allocatable :: pkz(:,:,:)         
 
  110 real(kind=
kind_real), 
allocatable :: tv(:,:,:)         
 
  113 logical :: have_geoph
 
  114 real(kind=
kind_real), 
allocatable :: geophi(:,:,:)         
 
  115 real(kind=
kind_real), 
allocatable :: geoph(:,:,:)         
 
  116 real(kind=
kind_real), 
allocatable :: suralt(:,:,:)         
 
  117 real(kind=
kind_real), 
pointer     :: phis(:,:,:)         
 
  118 logical,  
parameter :: use_compress = .true.
 
  123 real(kind=
kind_real), 
allocatable :: o3(:,:,:)         
 
  125 logical :: have_winds
 
  126 real(kind=
kind_real), 
allocatable :: ua(:,:,:)         
 
  127 real(kind=
kind_real), 
allocatable :: va(:,:,:)         
 
  128 real(kind=
kind_real), 
pointer     :: ud(:,:,:)         
 
  129 real(kind=
kind_real), 
pointer     :: vd(:,:,:)         
 
  132 logical :: have_slmsk
 
  133 real(kind=
kind_real), 
allocatable :: slmsk(:,:,:)       
 
  134 real(kind=
kind_real), 
pointer     :: frocean(:,:,:)       
 
  135 real(kind=
kind_real), 
pointer     :: frlake(:,:,:)       
 
  136 real(kind=
kind_real), 
pointer     :: frseaice(:,:,:)       
 
  137 real(kind=
kind_real), 
pointer     :: tsea(:,:,:)       
 
  141 real(kind=
kind_real), 
allocatable :: f10m(:,:,:)       
 
  142 real(kind=
kind_real), 
pointer     :: u_srf(:,:,:)
 
  143 real(kind=
kind_real), 
pointer     :: v_srf(:,:,:)
 
  148 real(kind=
kind_real), 
allocatable :: qi(:,:,:)
 
  149 real(kind=
kind_real), 
allocatable :: ql(:,:,:)
 
  150 real(kind=
kind_real), 
pointer     :: qils(:,:,:)
 
  151 real(kind=
kind_real), 
pointer     :: qicn(:,:,:)
 
  152 real(kind=
kind_real), 
pointer     :: qlls(:,:,:)
 
  153 real(kind=
kind_real), 
pointer     :: qlcn(:,:,:)
 
  157 real(kind=
kind_real), 
allocatable :: qmr(:,:,:)       
 
  160 logical :: have_crtm_cld
 
  161 real(kind=
kind_real), 
allocatable :: ql_ade(:,:,:)
 
  162 real(kind=
kind_real), 
allocatable :: qi_ade(:,:,:)
 
  163 real(kind=
kind_real), 
allocatable :: ql_efr(:,:,:)
 
  164 real(kind=
kind_real), 
allocatable :: qi_efr(:,:,:)
 
  165 real(kind=
kind_real), 
allocatable :: watercov(:,:)
 
  169 real(kind=
kind_real), 
allocatable :: sss(:,:,:)
 
  172 logical :: have_crtm_surface
 
  173 real(kind=
kind_real), 
pointer     :: sheleg(:,:,:)
 
  174 real(kind=
kind_real), 
pointer     :: vtype(:,:,:)
 
  175 real(kind=
kind_real), 
pointer     :: stype(:,:,:)
 
  176 real(kind=
kind_real), 
pointer     :: vfrac(:,:,:)
 
  177 real(kind=
kind_real), 
pointer     :: stc(:,:,:)
 
  178 real(kind=
kind_real), 
pointer     :: smc(:,:,:)
 
  179 real(kind=
kind_real), 
allocatable :: land_type_index(:,:,:)
 
  180 real(kind=
kind_real), 
allocatable :: vegetation_type_index(:,:,:)
 
  181 real(kind=
kind_real), 
allocatable :: soil_type(:,:,:)
 
  182 real(kind=
kind_real), 
allocatable :: water_area_fraction(:,:,:)
 
  183 real(kind=
kind_real), 
allocatable :: land_area_fraction(:,:,:)
 
  184 real(kind=
kind_real), 
allocatable :: ice_area_fraction(:,:,:)
 
  185 real(kind=
kind_real), 
allocatable :: surface_snow_area_fraction(:,:,:)
 
  186 real(kind=
kind_real), 
allocatable :: leaf_area_index(:,:,:)
 
  187 real(kind=
kind_real), 
allocatable :: surface_temperature_where_sea(:,:,:)
 
  188 real(kind=
kind_real), 
allocatable :: surface_temperature_where_land(:,:,:)
 
  189 real(kind=
kind_real), 
allocatable :: surface_temperature_where_ice(:,:,:)
 
  190 real(kind=
kind_real), 
allocatable :: surface_temperature_where_snow(:,:,:)
 
  191 real(kind=
kind_real), 
allocatable :: volume_fraction_of_condensed_water_in_soil(:,:,:)
 
  192 real(kind=
kind_real), 
allocatable :: vegetation_area_fraction(:,:,:)
 
  193 real(kind=
kind_real), 
allocatable :: soil_temperature(:,:,:)
 
  194 real(kind=
kind_real), 
allocatable :: surface_snow_thickness(:,:,:)
 
  195 real(kind=
kind_real), 
allocatable :: surface_wind_speed(:,:,:)
 
  196 real(kind=
kind_real), 
allocatable :: surface_wind_from_direction(:,:,:)
 
  197 real(kind=
kind_real), 
allocatable :: sea_surface_salinity(:,:,:)
 
  202 call copy_subset(xm%fields, xg%fields, fields_to_do)
 
  220 if (.not.
allocated(fields_to_do)) 
return 
  225 have_pressures = .false.
 
  227 if (xm%has_field(
'delp')) 
then 
  228   call xm%get_field(
'delp', delp)
 
  229   allocate(ps(self%isc:self%iec, self%jsc:self%jec, 1))
 
  230   ps(:,:,1) = sum(delp,3)
 
  231   have_pressures = .true.
 
  232 elseif (xm%has_field(
'ps')) 
then 
  233   call xm%get_field(
'ps', ps)
 
  234   allocate(delp(self%isc:self%iec, self%jsc:self%jec, self%npz))
 
  236     delp(:,:,jlev) = (geom%ak(jlev+1)-geom%ak(jlev))+(geom%bk(jlev+1)-geom%bk(jlev))*ps(:,:,1)
 
  238   have_pressures = .true.
 
  239 elseif (xm%has_field(
'pe')) 
then 
  240   call xm%get_field(
'pe', prsi)
 
  241   allocate(ps(self%isc:self%iec, self%jsc:self%jec, 1))
 
  242   ps(:,:,1) = prsi(:,:,self%npz+1)
 
  243   allocate(delp(self%isc:self%iec, self%jsc:self%jec, self%npz))
 
  245     delp(:,:,jlev) = prsi(:,:,jlev+1) - prsi(:,:,jlev)
 
  247   have_pressures = .true.
 
  250 if (have_pressures) 
then 
  251   if (.not.
allocated(prsi)) 
allocate(prsi(self%isc:self%iec,self%jsc:self%jec,self%npz+1))
 
  252   if (.not.
allocated(prs )) 
allocate(prs(self%isc:self%iec,self%jsc:self%jec,self%npz  ))
 
  261 if (xm%has_field( 
't')) 
then 
  262   call xm%get_field(
't', t)
 
  264 elseif (xm%has_field( 
'pt')) 
then 
  265   if (.not. have_pressures) &
 
  266     call abor1_ftn(
"fv3jedi_vc_model2geovals_mod.changevar: a state with pt needs pressures")
 
  267   allocate(t(self%isc:self%iec, self%jsc:self%jec, self%npz))
 
  268   allocate(pkz(self%isc:self%iec, self%jsc:self%jec, self%npz))
 
  269   call xm%get_field(
'pt',  pt)
 
  279 if (xm%has_field( 
'sphum')) 
then 
  280   call xm%get_field(
'sphum',  q)
 
  288 if (xm%has_field(
'rh')) 
then 
  289   call xm%get_field(
'rh', rh)
 
  291 elseif (have_t .and. have_pressures .and. have_q) 
then 
  292   allocate(qsat(self%isc:self%iec,self%jsc:self%jec,self%npz))
 
  293   allocate(rh(self%isc:self%iec,self%jsc:self%jec,self%npz))
 
  304 if (have_t .and. have_pressures .and. have_q .and. xm%has_field( 
'phis')) 
then 
  305   call xm%get_field(
'phis',  phis)
 
  306   if (.not.
allocated(geophi)) 
allocate(geophi(self%isc:self%iec,self%jsc:self%jec,self%npz+1))
 
  307   if (.not.
allocated(geoph )) 
allocate(geoph(self%isc:self%iec,self%jsc:self%jec,self%npz  ))
 
  308   if (.not.
allocated(suralt)) 
allocate(suralt(self%isc:self%iec,self%jsc:self%jec,self%npz  ))
 
  309   call geop_height(geom, prs, prsi, t, q, phis(:,:,1), use_compress, geoph)
 
  319 if (have_t .and. have_q) 
then 
  320   allocate(tv(self%isc:self%iec,self%jsc:self%jec,self%npz))
 
  330 if (xm%has_field( 
'o3mr') .or. xm%has_field( 
'o3ppmv')) 
then 
  331   if (xm%has_field( 
'o3mr')) 
call xm%get_field(
'o3mr', o3)
 
  332   if (xm%has_field( 
'o3ppmv')) 
call xm%get_field(
'o3ppmv', o3)
 
  333   have_mass = xm%has_field( 
'o3mr')
 
  336     do j = self%jsc, self%jec
 
  337       do i = self%isc, self%iec
 
  338         if (o3(i,j,k) >= 0.0_kind_real .and. have_mass) 
then 
  339           o3(i,j,k) = o3(i,j,k) * 
constoz 
  340         else if (o3(i,j,k) < 0.0_kind_real ) 
then 
  341           o3(i,j,k) = 0.0_kind_real
 
  352 if (xm%has_field(
'ua')) 
then 
  353   call xm%get_field(
'ua', ua)
 
  354   call xm%get_field(
'va', va)
 
  356 elseif (xm%has_field(
'ud')) 
then 
  357   call xm%get_field(
'ud', ud)
 
  358   call xm%get_field(
'vd', vd)
 
  359   allocate(ua(self%isc:self%iec,self%jsc:self%jec,self%npz))
 
  360   allocate(va(self%isc:self%iec,self%jsc:self%jec,self%npz))
 
  361   call d2a(geom, ud, vd, ua, va)
 
  369 if (xm%has_field( 
'slmsk')) 
then 
  370   call xm%get_field(
'slmsk', slmsk)
 
  372 elseif ( xm%has_field(
'frocean' ) .and. xm%has_field(
'frlake'  ) .and. &
 
  373          xm%has_field(
'frseaice') .and. xm%has_field(
'tsea'    ) ) 
then 
  374   call xm%get_field(
'frocean' , frocean )
 
  375   call xm%get_field(
'frlake'  , frlake  )
 
  376   call xm%get_field(
'frseaice', frseaice)
 
  377   call xm%get_field(
'tsea'    , tsea    )
 
  379   allocate(slmsk(self%isc:self%iec,self%jsc:self%jec,1))
 
  380   slmsk = 1.0_kind_real 
 
  381   do j = self%jsc,self%jec
 
  382     do i = self%isc,self%iec
 
  383       if ( frocean(i,j,1) + frlake(i,j,1) >= 0.6_kind_real) 
then 
  384         slmsk(i,j,1) = 0.0_kind_real 
 
  386       if ( slmsk(i,j,1) == 0.0_kind_real .and. frseaice(i,j,1) > 0.5_kind_real) 
then 
  387         slmsk(i,j,1) = 2.0_kind_real 
 
  389       if ( slmsk(i,j,1) == 0.0_kind_real .and. tsea(i,j,1) < 271.4_kind_real ) 
then 
  390         slmsk(i,j,1) = 2.0_kind_real 
 
  401 if (xm%has_field(
'f10m')) 
then 
  402   call xm%get_field(
'f10m', f10m)
 
  404 elseif ( xm%has_field( 
'u_srf') .and. xm%has_field( 
'v_srf') .and. have_winds ) 
then 
  405   call xm%get_field(
'u_srf' , u_srf)
 
  406   call xm%get_field(
'v_srf' , v_srf)
 
  408   allocate(f10m(self%isc:self%iec,self%jsc:self%jec,1))
 
  409   f10m = sqrt(u_srf**2 + v_srf**2)
 
  411   do j = self%jsc,self%jec
 
  412     do i = self%isc,self%iec
 
  413       wspd = sqrt(ua(i,j,self%npz)**2 +  va(i,j,self%npz)**2)
 
  414       if (f10m(i,j,1) > 0.0_kind_real) 
then 
  415         f10m(i,j,1) = f10m(i,j,1)/wspd
 
  417         f10m(i,j,1) = 1.0_kind_real
 
  429   allocate(qmr(self%isc:self%iec,self%jsc:self%jec,self%npz))
 
  438 if (xm%has_field( 
'ice_wat') .and. xm%has_field( 
'liq_wat')) 
then 
  439   call xm%get_field(
'ice_wat', qi)
 
  440   call xm%get_field(
'liq_wat', ql)
 
  442 elseif (xm%has_field( 
'qils') .and. xm%has_field( 
'qicn') .and. &
 
  443         xm%has_field( 
'qlls') .and. xm%has_field( 
'qlcn')) 
then 
  444   call xm%get_field(
'qils', qils)
 
  445   call xm%get_field(
'qicn', qicn)
 
  446   call xm%get_field(
'qlls', qlls)
 
  447   call xm%get_field(
'qlcn', qlcn)
 
  448   allocate(qi(self%isc:self%iec,self%jsc:self%jec,self%npz))
 
  449   allocate(ql(self%isc:self%iec,self%jsc:self%jec,self%npz))
 
  458 have_crtm_cld = .false.
 
  459 if (have_slmsk .and. have_t .and. have_pressures .and. have_q .and. have_qiql ) 
then 
  460   allocate(ql_ade(self%isc:self%iec,self%jsc:self%jec,self%npz))
 
  461   allocate(qi_ade(self%isc:self%iec,self%jsc:self%jec,self%npz))
 
  462   allocate(ql_efr(self%isc:self%iec,self%jsc:self%jec,self%npz))
 
  463   allocate(qi_efr(self%isc:self%iec,self%jsc:self%jec,self%npz))
 
  464   allocate(watercov(self%isc:self%iec,self%jsc:self%jec))
 
  465   ql_ade = 0.0_kind_real
 
  466   qi_ade = 0.0_kind_real
 
  467   ql_efr = 0.0_kind_real
 
  468   qi_efr = 0.0_kind_real
 
  471   watercov = 0.0_kind_real
 
  472   do j = self%jsc,self%jec
 
  473     do i = self%isc,self%iec
 
  474       if (slmsk(i,j,1) == 0) watercov(i,j) = 1.0_kind_real
 
  477   call crtm_ade_efr( geom, prsi, t, delp, watercov, q, ql, qi, &
 
  478                      ql_ade, qi_ade, ql_efr, qi_efr )
 
  479   have_crtm_cld = .true.
 
  485 have_crtm_surface = .false.
 
  487 if ( have_slmsk .and. have_f10m .and. xm%has_field( 
'sheleg') .and. &
 
  488      xm%has_field( 
'tsea'  ) .and. xm%has_field( 
'vtype' ) .and. &
 
  489      xm%has_field( 
'stype' ) .and. xm%has_field( 
'vfrac' ) .and. &
 
  490      xm%has_field( 
'stc'   ) .and. xm%has_field( 
'smc'   ) .and. &
 
  491      xm%has_field( 
'u_srf' ) .and. xm%has_field( 
'v_srf' ) ) 
then 
  493   call xm%get_field(
'sheleg', sheleg)
 
  494   call xm%get_field(
'tsea'  , tsea  )
 
  495   call xm%get_field(
'vtype' , vtype )
 
  496   call xm%get_field(
'stype' , stype )
 
  497   call xm%get_field(
'vfrac' , vfrac )
 
  498   call xm%get_field(
'stc'   , stc   )
 
  499   call xm%get_field(
'smc'   , smc   )
 
  500   call xm%get_field(
'u_srf' , u_srf )
 
  501   call xm%get_field(
'v_srf' , v_srf )
 
  503   allocate(land_type_index(self%isc:self%iec,self%jsc:self%jec,1))
 
  504   allocate(vegetation_type_index(self%isc:self%iec,self%jsc:self%jec,1))
 
  505   allocate(soil_type(self%isc:self%iec,self%jsc:self%jec,1))
 
  506   allocate(water_area_fraction(self%isc:self%iec,self%jsc:self%jec,1))
 
  507   allocate(land_area_fraction(self%isc:self%iec,self%jsc:self%jec,1))
 
  508   allocate(ice_area_fraction(self%isc:self%iec,self%jsc:self%jec,1))
 
  509   allocate(surface_snow_area_fraction(self%isc:self%iec,self%jsc:self%jec,1))
 
  510   allocate(leaf_area_index(self%isc:self%iec,self%jsc:self%jec,1))
 
  511   allocate(surface_temperature_where_sea(self%isc:self%iec,self%jsc:self%jec,1))
 
  512   allocate(surface_temperature_where_land(self%isc:self%iec,self%jsc:self%jec,1))
 
  513   allocate(surface_temperature_where_ice(self%isc:self%iec,self%jsc:self%jec,1))
 
  514   allocate(surface_temperature_where_snow(self%isc:self%iec,self%jsc:self%jec,1))
 
  515   allocate(volume_fraction_of_condensed_water_in_soil(self%isc:self%iec,self%jsc:self%jec,1))
 
  516   allocate(vegetation_area_fraction(self%isc:self%iec,self%jsc:self%jec,1))
 
  517   allocate(soil_temperature(self%isc:self%iec,self%jsc:self%jec,1))
 
  518   allocate(surface_snow_thickness(self%isc:self%iec,self%jsc:self%jec,1))
 
  519   allocate(surface_wind_speed(self%isc:self%iec,self%jsc:self%jec,1))
 
  520   allocate(surface_wind_from_direction(self%isc:self%iec,self%jsc:self%jec,1))
 
  521   allocate(sea_surface_salinity(self%isc:self%iec,self%jsc:self%jec,1))
 
  523   allocate(sss(self%isc:self%iec,self%jsc:self%jec,1))
 
  525   if (xm%has_field( 
'sss')) 
then 
  526     call xm%get_field(
'sss', sss)
 
  530   call crtm_surface( geom, slmsk, sheleg, tsea, vtype, stype, vfrac, stc, smc, u_srf, v_srf, &
 
  531                       f10m, sss, land_type_index, vegetation_type_index, soil_type, &
 
  532                       water_area_fraction, land_area_fraction, ice_area_fraction, &
 
  533                       surface_snow_area_fraction, leaf_area_index, surface_temperature_where_sea, &
 
  534                       surface_temperature_where_land, surface_temperature_where_ice, &
 
  535                       surface_temperature_where_snow, volume_fraction_of_condensed_water_in_soil, &
 
  536                       vegetation_area_fraction, soil_temperature, surface_snow_thickness, &
 
  537                       surface_wind_speed, surface_wind_from_direction, sea_surface_salinity)
 
  539   have_crtm_surface = .true.
 
  546 do f = 1, 
size(fields_to_do)
 
  548   call xg%get_field(trim(fields_to_do(f)),  field_ptr)
 
  550   select case (trim(fields_to_do(f)))
 
  554     if (.not. have_winds) 
call field_fail(fields_to_do(f))
 
  559     if (.not. have_winds) 
call field_fail(fields_to_do(f))
 
  564     if (.not. have_q) 
call field_fail(fields_to_do(f))
 
  569     if (.not. have_rh) 
call field_fail(fields_to_do(f))
 
  574     if (.not. have_pressures) 
call field_fail(fields_to_do(f))
 
  579     if (.not. have_pressures) 
call field_fail(fields_to_do(f))
 
  584     if (.not. have_pressures) 
call field_fail(fields_to_do(f))
 
  589     if (.not. have_pressures) 
call field_fail(fields_to_do(f))
 
  594     if (.not. have_t) 
call field_fail(fields_to_do(f))
 
  599     if (.not. have_tv) 
call field_fail(fields_to_do(f))
 
  602   case (
"mole_fraction_of_ozone_in_air")
 
  603     if (.not. have_o3) 
call field_fail(fields_to_do(f))
 
  606   case (
"geopotential_height", 
"height")
 
  608     if (.not. have_geoph) 
call field_fail(fields_to_do(f))
 
  611   case (
"geopotential_height_levels")
 
  613     if (.not. have_geoph) 
call field_fail(fields_to_do(f))
 
  616   case (
"surface_altitude")
 
  618     if (.not. have_geoph) 
call field_fail(fields_to_do(f))
 
  621   case (
"mole_fraction_of_carbon_dioxide_in_air")
 
  623     field_ptr = 407.0_kind_real
 
  625   case (
"humidity_mixing_ratio")
 
  627     if (.not. have_qmr) 
call field_fail(fields_to_do(f))
 
  630   case (
"mass_content_of_cloud_liquid_water_in_atmosphere_layer")
 
  632     if (.not. have_crtm_cld) 
call field_fail(fields_to_do(f))
 
  635   case (
"mass_content_of_cloud_ice_in_atmosphere_layer")
 
  637     if (.not. have_crtm_cld) 
call field_fail(fields_to_do(f))
 
  640   case (
"effective_radius_of_cloud_liquid_water_particle")
 
  642     if (.not. have_crtm_cld) 
call field_fail(fields_to_do(f))
 
  645   case (
"effective_radius_of_cloud_ice_particle")
 
  647     if (.not. have_crtm_cld) 
call field_fail(fields_to_do(f))
 
  650   case (
"water_area_fraction")
 
  652     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  653     field_ptr = water_area_fraction
 
  655   case (
"land_area_fraction")
 
  657     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  658     field_ptr = land_area_fraction
 
  660   case (
"ice_area_fraction")
 
  662     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  663     field_ptr = ice_area_fraction
 
  665   case (
"surface_snow_area_fraction")
 
  667     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  668     field_ptr = surface_snow_area_fraction
 
  670   case (
"surface_temperature_where_sea")
 
  672     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  673     field_ptr = surface_temperature_where_sea
 
  675   case (
"sea_surface_salinity")
 
  677     if (.not. have_sss) 
call field_fail(fields_to_do(f))
 
  678     field_ptr = sea_surface_salinity
 
  680   case (
"surface_temperature_where_land")
 
  682     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  683     field_ptr = surface_temperature_where_land
 
  685   case (
"surface_temperature_where_ice")
 
  687     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  688     field_ptr = surface_temperature_where_ice
 
  690   case (
"surface_temperature_where_snow")
 
  692     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  693     field_ptr = surface_temperature_where_snow
 
  695   case (
"surface_snow_thickness")
 
  697     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  698     field_ptr = surface_snow_thickness
 
  700   case (
"vegetation_area_fraction")
 
  702     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  703     field_ptr = vegetation_area_fraction
 
  705   case (
"surface_wind_speed")
 
  707     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  708     field_ptr = surface_wind_speed
 
  710   case (
"surface_wind_from_direction")
 
  712     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  713     field_ptr = surface_wind_from_direction
 
  715   case (
"leaf_area_index")
 
  717     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  718     field_ptr = leaf_area_index
 
  720   case (
"volume_fraction_of_condensed_water_in_soil")
 
  722     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  723     field_ptr = volume_fraction_of_condensed_water_in_soil
 
  725   case (
"soil_temperature")
 
  727     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  728     field_ptr = soil_temperature
 
  730   case (
"land_type_index")
 
  732     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  733     field_ptr = land_type_index
 
  735   case (
"vegetation_type_index")
 
  737     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  738     field_ptr = vegetation_type_index
 
  742     if (.not. have_crtm_surface) 
call field_fail(fields_to_do(f))
 
  743     field_ptr = soil_type
 
  747     call abor1_ftn(
"fv3jedi_vc_model2geovals_mod.changevar unknown field: "//trim(fields_to_do(f)) &
 
  748                    //
". Not in input field and no transform case specified.")
 
  757 xg%calendar_type = xm%calendar_type
 
  758 xg%date_init = xm%date_init
 
  761 if (
associated(sheleg)) 
nullify(sheleg)
 
  762 if (
associated(vtype)) 
nullify(vtype)
 
  763 if (
associated(stype)) 
nullify(stype)
 
  764 if (
associated(vfrac)) 
nullify(vfrac)
 
  765 if (
associated(stc)) 
nullify(stc)
 
  766 if (
associated(smc)) 
nullify(smc)
 
  767 if (
associated(field_ptr)) 
nullify(field_ptr)
 
  768 if (
associated(q)) 
nullify(q)
 
  769 if (
associated(qsat)) 
nullify(qsat)
 
  770 if (
associated(pt)) 
nullify(pt)
 
  771 if (
associated(phis)) 
nullify(phis)
 
  772 if (
associated(ud)) 
nullify(ud)
 
  773 if (
associated(vd)) 
nullify(vd)
 
  774 if (
associated(frocean)) 
nullify(frocean)
 
  775 if (
associated(frlake)) 
nullify(frlake)
 
  776 if (
associated(frseaice)) 
nullify(frseaice)
 
  777 if (
associated(tsea)) 
nullify(tsea)
 
  778 if (
associated(u_srf)) 
nullify(u_srf)
 
  779 if (
associated(v_srf)) 
nullify(v_srf)
 
  780 if (
associated(qils)) 
nullify(qils)
 
  781 if (
associated(qlls)) 
nullify(qlls)
 
  782 if (
associated(qicn)) 
nullify(qicn)
 
  783 if (
associated(qlcn)) 
nullify(qlcn)
 
  785 if (
allocated(fields_to_do)) 
deallocate(fields_to_do)
 
  786 if (
allocated(rh)) 
deallocate(rh)
 
  787 if (
allocated(t)) 
deallocate(t)
 
  788 if (
allocated(tv)) 
deallocate(tv)
 
  789 if (
allocated(ps)) 
deallocate(ps)
 
  790 if (
allocated(delp)) 
deallocate(delp)
 
  791 if (
allocated(prsi)) 
deallocate(prsi)
 
  792 if (
allocated(prs)) 
deallocate(prs)
 
  793 if (
allocated(pkz)) 
deallocate(pkz)
 
  794 if (
allocated(geophi)) 
deallocate(geophi)
 
  795 if (
allocated(geoph)) 
deallocate(geoph)
 
  796 if (
allocated(suralt)) 
deallocate(suralt)
 
  797 if (
allocated(o3)) 
deallocate(o3)
 
  798 if (
allocated(ua)) 
deallocate(ua)
 
  799 if (
allocated(va)) 
deallocate(va)
 
  800 if (
allocated(slmsk)) 
deallocate(slmsk)
 
  801 if (
allocated(f10m)) 
deallocate(f10m)
 
  802 if (
allocated(ql)) 
deallocate(ql)
 
  803 if (
allocated(qi)) 
deallocate(qi)
 
  804 if (
allocated(qmr)) 
deallocate(qmr)
 
  805 if (
allocated(ql_ade)) 
deallocate(ql_ade)
 
  806 if (
allocated(qi_ade)) 
deallocate(qi_ade)
 
  807 if (
allocated(ql_efr)) 
deallocate(ql_efr)
 
  808 if (
allocated(qi_efr)) 
deallocate(qi_efr)
 
  809 if (
allocated(watercov)) 
deallocate(watercov)
 
  810 if (
allocated(sss)) 
deallocate(sss)
 
  811 if (
allocated(land_type_index)) 
deallocate(land_type_index)
 
  812 if (
allocated(vegetation_type_index)) 
deallocate(vegetation_type_index)
 
  813 if (
allocated(soil_type)) 
deallocate(soil_type)
 
  814 if (
allocated(water_area_fraction)) 
deallocate(water_area_fraction)
 
  815 if (
allocated(land_area_fraction)) 
deallocate(land_area_fraction)
 
  816 if (
allocated(ice_area_fraction)) 
deallocate(ice_area_fraction)
 
  817 if (
allocated(surface_snow_area_fraction)) 
deallocate(surface_snow_area_fraction)
 
  818 if (
allocated(leaf_area_index)) 
deallocate(leaf_area_index)
 
  819 if (
allocated(surface_temperature_where_sea)) 
deallocate(surface_temperature_where_sea)
 
  820 if (
allocated(surface_temperature_where_land)) 
deallocate(surface_temperature_where_land)
 
  821 if (
allocated(surface_temperature_where_ice)) 
deallocate(surface_temperature_where_ice)
 
  822 if (
allocated(surface_temperature_where_snow)) 
deallocate(surface_temperature_where_snow)
 
  823 if (
allocated(volume_fraction_of_condensed_water_in_soil)) &
 
  824                                               deallocate(volume_fraction_of_condensed_water_in_soil)
 
  825 if (
allocated(vegetation_area_fraction)) 
deallocate(vegetation_area_fraction)
 
  826 if (
allocated(soil_temperature)) 
deallocate(soil_temperature)
 
  827 if (
allocated(surface_snow_thickness)) 
deallocate(surface_snow_thickness)
 
  828 if (
allocated(surface_wind_speed)) 
deallocate(surface_wind_speed)
 
  829 if (
allocated(surface_wind_from_direction)) 
deallocate(surface_wind_from_direction)
 
  830 if (
allocated(sea_surface_salinity)) 
deallocate(sea_surface_salinity)