[Dart-dev] [7384] DART/trunk: code contributed by Soyoung Ha.

nancy at ucar.edu nancy at ucar.edu
Fri Jan 16 14:54:30 MST 2015


Revision: 7384
Author:   nancy
Date:     2015-01-16 14:54:30 -0700 (Fri, 16 Jan 2015)
Log Message:
-----------
code contributed by Soyoung Ha.  GPS precipitable water
observations converter, and updates to the MPAS model_mod
to assimilate them.   also updates to the mpas_dart_obs_preprocess
program to support a minimum height for GPS RO obs; lower obs
can be removed because they are subject to higher errors.

Modified Paths:
--------------
    DART/trunk/models/mpas_atm/model_mod.f90
    DART/trunk/models/mpas_atm/mpas_dart_obs_preprocess.f90
    DART/trunk/obs_kind/DEFAULT_obs_kind_mod.F90

Added Paths:
-----------
    DART/trunk/observations/GPSPW/
    DART/trunk/observations/GPSPW/README
    DART/trunk/observations/GPSPW/convert_gpspw.f90
    DART/trunk/observations/GPSPW/data/
    DART/trunk/observations/GPSPW/data/CsuPWVh_2012.146.00.00.0060_nc
    DART/trunk/observations/GPSPW/data/GsuPWVd_2012.146.00.00.1440_nc
    DART/trunk/observations/GPSPW/data/Readme
    DART/trunk/observations/GPSPW/shell_scripts/
    DART/trunk/observations/GPSPW/shell_scripts/get_gpspwv.csh
    DART/trunk/observations/GPSPW/shell_scripts/run_convert_gpspw.csh
    DART/trunk/observations/GPSPW/shell_scripts/run_convert_gpspw_conus.csh
    DART/trunk/observations/GPSPW/shell_scripts/run_obs_seq_tool_gpspw.csh
    DART/trunk/observations/GPSPW/work/
    DART/trunk/observations/GPSPW/work/Makefile
    DART/trunk/observations/GPSPW/work/input.nml
    DART/trunk/observations/GPSPW/work/mkmf_advance_time
    DART/trunk/observations/GPSPW/work/mkmf_convert_gpspw
    DART/trunk/observations/GPSPW/work/mkmf_obs_sequence_tool
    DART/trunk/observations/GPSPW/work/mkmf_preprocess
    DART/trunk/observations/GPSPW/work/path_names_advance_time
    DART/trunk/observations/GPSPW/work/path_names_convert_gpspw
    DART/trunk/observations/GPSPW/work/path_names_obs_sequence_tool
    DART/trunk/observations/GPSPW/work/path_names_preprocess
    DART/trunk/observations/GPSPW/work/quickbuild.csh

-------------- next part --------------
Modified: DART/trunk/models/mpas_atm/model_mod.f90
===================================================================
--- DART/trunk/models/mpas_atm/model_mod.f90	2015-01-16 21:28:00 UTC (rev 7383)
+++ DART/trunk/models/mpas_atm/model_mod.f90	2015-01-16 21:54:30 UTC (rev 7384)
@@ -63,10 +63,15 @@
                              KIND_V_WIND_COMPONENT,   &
                              KIND_PRESSURE,           &
                              KIND_DENSITY,            &
-                             KIND_VAPOR_MIXING_RATIO, &
-                             KIND_SPECIFIC_HUMIDITY,  &
+                             KIND_VAPOR_MIXING_RATIO,      &
+                             KIND_CLOUDWATER_MIXING_RATIO, &
+                             KIND_RAINWATER_MIXING_RATIO,  &
+                             KIND_ICE_MIXING_RATIO,        &
+                             KIND_SNOW_MIXING_RATIO,       &
+                             KIND_GRAUPEL_MIXING_RATIO,    &
+                             KIND_SPECIFIC_HUMIDITY,       &
                              KIND_GEOPOTENTIAL_HEIGHT, &
-                             KIND_TOTAL_PRECIPITABLE_WATER
+                             KIND_PRECIPITABLE_WATER
 
 use mpi_utilities_mod, only: my_task_id
 
@@ -120,6 +125,7 @@
           get_analysis_time,            &
           write_model_time,             &
           get_grid_dims,                &
+          get_xland,                    &
           print_variable_ranges,        &
           find_closest_cell_center
 
@@ -159,6 +165,13 @@
 type(xyz_location_type), allocatable :: cell_locs(:)
 
 
+! compile-time control over whether grid information is written to the
+! diagnostic files or not.  if it is, the files are self-contained (e.g. for
+! ease of plotting), but are also much larger than they would be otherwise.
+! change this private variable to control whether the grid information is
+! written or not.
+logical :: add_static_data_to_diags = .false.
+
 ! variables which are in the module namelist
 integer            :: vert_localization_coord = VERTISHEIGHT
 integer            :: assimilation_period_days = 0
@@ -294,10 +307,10 @@
 real(r8), allocatable :: latEdge(:) ! edge longitudes (degrees, original radians in file)
 real(r8), allocatable :: lonCell(:) ! cell center longitudes (degrees, original radians in file)
 real(r8), allocatable :: latCell(:) ! cell center latitudes  (degrees, original radians in file)
+real(r8), allocatable :: xland(:)   ! LAND MASK (1 FOR LAND, 2 FOR WATER)
 real(r8), allocatable :: zGridFace(:,:)   ! geometric height at cell faces   (nVertLevelsP1,nCells)
 real(r8), allocatable :: zGridCenter(:,:) ! geometric height at cell centers (nVertLevels,  nCells)
 real(r8), allocatable :: zGridEdge(:,:)   ! geometric height at edge centers (nVertLevels,  nEdges)
-
 !real(r8), allocatable :: zEdgeFace(:,:)   ! geometric height at edges faces  (nVertLevelsP1,nEdges)
 !real(r8), allocatable :: zEdgeCenter(:,:) ! geometric height at edges faces  (nVertLevels  ,nEdges)
 
@@ -481,6 +494,7 @@
 
 allocate(cellsOnVertex(vertexDegree, nVertices))
 allocate(nEdgesOnCell(nCells))
+allocate(xland(nCells))
 allocate(edgesOnCell(maxEdges, nCells))
 allocate(cellsOnEdge(2, nEdges))
 allocate(verticesOnCell(maxEdges, nCells))
@@ -1005,7 +1019,7 @@
          goodkind = .true.
       case (KIND_SPECIFIC_HUMIDITY)
          goodkind = .true.
-      case (KIND_TOTAL_PRECIPITABLE_WATER) 
+      case (KIND_PRECIPITABLE_WATER) 
          goodkind = .true.
       case (KIND_U_WIND_COMPONENT,KIND_V_WIND_COMPONENT)
          ! if the reconstructed winds at the cell centers aren't there,
@@ -1107,14 +1121,9 @@
    endif
    interp_val = query_location(location_tmp, 'VLOC')
 
-else if (obs_kind == KIND_TOTAL_PRECIPITABLE_WATER) then
+else if (obs_kind == KIND_SURFACE_PRESSURE   .or. &
+         obs_kind == KIND_PRECIPITABLE_WATER ) then
    tvars(1) = ivar
-   call compute_scalar_with_barycentric(x, location, 1, tvars, values, istatus)
-   interp_val = values(1)
-   if (istatus /= 0) goto 100
-
-else if (obs_kind == KIND_SURFACE_PRESSURE) then
-   tvars(1) = ivar
    loc_array = get_location(location)
    location_tmp = set_location(loc_array(1),loc_array(2),0.0_r8,VERTISSURFACE)
    call compute_scalar_with_barycentric(x, location_tmp, 1, tvars, values, istatus)
@@ -1332,17 +1341,22 @@
    call nc_check(nf90_def_dim(ncid=ncFileID, name='nEdges', &
           len = nEdges, dimid = nEdgesDimID),'nc_write_model_atts', 'nEdges def_dim '//trim(filename))
 
-   call nc_check(nf90_def_dim(ncid=ncFileID, name='maxEdges', &
-          len = maxEdges, dimid = maxEdgesDimID),'nc_write_model_atts', 'maxEdges def_dim '//trim(filename))
+   if (add_static_data_to_diags) then
+      !----------------------------------------------------------------------------
+      ! Dimensions needed only if you are writing out static grid information
+      !----------------------------------------------------------------------------
+      call nc_check(nf90_def_dim(ncid=ncFileID, name='maxEdges', &
+             len = maxEdges, dimid = maxEdgesDimID),'nc_write_model_atts', 'maxEdges def_dim '//trim(filename))
+   
+      call nc_check(nf90_def_dim(ncid=ncFileID, name='nVertices', &
+             len = nVertices, dimid = nVerticesDimID),'nc_write_model_atts', &
+                  'nVertices def_dim '//trim(filename))
+   
+      call nc_check(nf90_def_dim(ncid=ncFileID, name='VertexDegree', &
+             len = VertexDegree, dimid = VertexDegreeDimID),'nc_write_model_atts', &
+                  'VertexDegree def_dim '//trim(filename))
+   endif  ! add_static_data_to_diags
 
-   call nc_check(nf90_def_dim(ncid=ncFileID, name='nVertices', &
-          len = nVertices, dimid = nVerticesDimID),'nc_write_model_atts', &
-               'nVertices def_dim '//trim(filename))
-
-   call nc_check(nf90_def_dim(ncid=ncFileID, name='VertexDegree', &
-          len = VertexDegree, dimid = VertexDegreeDimID),'nc_write_model_atts', &
-               'VertexDegree def_dim '//trim(filename))
-
    call nc_check(nf90_def_dim(ncid=ncFileID, name='nVertLevels', &
           len = nVertLevels, dimid = NVertLevelsDimID),'nc_write_model_atts', &
                                       'nVertLevels def_dim '//trim(filename))
@@ -1355,116 +1369,118 @@
           len = nSoilLevels, dimid = nSoilLevelsDimID),'nc_write_model_atts', &
                'nSoilLevels def_dim '//trim(filename))
 
-   !----------------------------------------------------------------------------
-   ! Create the (empty) Coordinate Variables and the Attributes
-   !----------------------------------------------------------------------------
+   if (add_static_data_to_diags) then
+      !----------------------------------------------------------------------------
+      ! Create the (empty) Coordinate Variables and the Attributes
+      !----------------------------------------------------------------------------
+      ! Cell Longitudes
+      call nc_check(nf90_def_var(ncFileID,name='lonCell', xtype=nf90_double, &
+                    dimids=nCellsDimID, varid=VarID),&
+                    'nc_write_model_atts', 'lonCell def_var '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'cell center longitudes'), &
+                    'nc_write_model_atts', 'lonCell long_name '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'units', 'degrees_east'), &
+                    'nc_write_model_atts', 'lonCell units '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'valid_range', (/ 0.0_r8, 360.0_r8 /)), &
+                    'nc_write_model_atts', 'lonCell valid_range '//trim(filename))
+   
+      ! Cell Latitudes
+      call nc_check(nf90_def_var(ncFileID,name='latCell', xtype=nf90_double, &
+                    dimids=nCellsDimID, varid=VarID),&
+                    'nc_write_model_atts', 'latCell def_var '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'cell center latitudes'), &
+                    'nc_write_model_atts', 'latCell long_name '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'units', 'degrees_north'),  &
+                    'nc_write_model_atts', 'latCell units '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID,'valid_range',(/ -90.0_r8, 90.0_r8 /)), &
+                    'nc_write_model_atts', 'latCell valid_range '//trim(filename))
+   
+      call nc_check(nf90_def_var(ncFileID,name='xCell', xtype=nf90_double, &
+                    dimids=nCellsDimID, varid=VarID),&
+                    'nc_write_model_atts', 'xCell def_var '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'cell center x cartesian coordinates'), &
+                    'nc_write_model_atts', 'xCell long_name '//trim(filename))
+   
+      call nc_check(nf90_def_var(ncFileID,name='yCell', xtype=nf90_double, &
+                    dimids=nCellsDimID, varid=VarID),&
+                    'nc_write_model_atts', 'yCell def_var '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'cell center y cartesian coordinates'), &
+                    'nc_write_model_atts', 'yCell long_name '//trim(filename))
+   
+      call nc_check(nf90_def_var(ncFileID,name='zCell', xtype=nf90_double, &
+                    dimids=nCellsDimID, varid=VarID),&
+                    'nc_write_model_atts', 'zCell def_var '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'cell center z cartesian coordinates'), &
+                    'nc_write_model_atts', 'zCell long_name '//trim(filename))
+   
+      ! Grid vertical information
+      call nc_check(nf90_def_var(ncFileID,name='zgrid',xtype=nf90_double, &
+                    dimids=(/ nVertLevelsP1DimID, nCellsDimID /) ,varid=VarID), &
+                    'nc_write_model_atts', 'zgrid def_var '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'grid zgrid'), &
+                    'nc_write_model_atts', 'zgrid long_name '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'units', 'meters'),  &
+                    'nc_write_model_atts', 'zgrid units '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'positive', 'up'),  &
+                    'nc_write_model_atts', 'zgrid units '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'cartesian_axis', 'Z'),   &
+                    'nc_write_model_atts', 'zgrid cartesian_axis '//trim(filename))
+   
+      ! Vertex Longitudes
+      call nc_check(nf90_def_var(ncFileID,name='lonVertex', xtype=nf90_double, &
+                    dimids=nVerticesDimID, varid=VarID),&
+                    'nc_write_model_atts', 'lonVertex def_var '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'vertex longitudes'), &
+                    'nc_write_model_atts', 'lonVertex long_name '//trim(filename))
+   
+      ! Vertex Latitudes
+      call nc_check(nf90_def_var(ncFileID,name='latVertex', xtype=nf90_double, &
+                    dimids=nVerticesDimID, varid=VarID),&
+                    'nc_write_model_atts', 'latVertex def_var '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'vertex latitudes'), &
+                    'nc_write_model_atts', 'latVertex long_name '//trim(filename))
+   
+      if(data_on_edges) then
+         ! Edge Longitudes
+         call nc_check(nf90_def_var(ncFileID,name='lonEdge', xtype=nf90_double, &
+                       dimids=nEdgesDimID, varid=VarID),&
+                       'nc_write_model_atts', 'lonEdge def_var '//trim(filename))
+         call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'edge longitudes'), &
+                       'nc_write_model_atts', 'lonEdge long_name '//trim(filename))
+   
+         ! Edge Latitudes
+         call nc_check(nf90_def_var(ncFileID,name='latEdge', xtype=nf90_double, &
+                       dimids=nEdgesDimID, varid=VarID),&
+                       'nc_write_model_atts', 'latEdge def_var '//trim(filename))
+         call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'edge latitudes'), &
+                       'nc_write_model_atts', 'latEdge long_name '//trim(filename))
+      endif
+   
+      ! Grid relationship information
+      call nc_check(nf90_def_var(ncFileID,name='nEdgesOnCell',xtype=nf90_int, &
+                    dimids=nCellsDimID ,varid=VarID), &
+                    'nc_write_model_atts', 'nEdgesOnCell def_var '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'grid nEdgesOnCell'), &
+                    'nc_write_model_atts', 'nEdgesOnCell long_name '//trim(filename))
+   
+      call nc_check(nf90_def_var(ncFileID,name='cellsOnVertex',xtype=nf90_int, &
+                    dimids=(/ VertexDegreeDimID, nVerticesDimID /) ,varid=VarID), &
+                    'nc_write_model_atts', 'cellsOnVertex def_var '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'grid cellsOnVertex'), &
+                    'nc_write_model_atts', 'cellsOnVertex long_name '//trim(filename))
+   
+      call nc_check(nf90_def_var(ncFileID,name='verticesOnCell',xtype=nf90_int, &
+                    dimids=(/ maxEdgesDimID, nCellsDimID /) ,varid=VarID), &
+                    'nc_write_model_atts', 'verticesOnCell def_var '//trim(filename))
+      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'grid verticesOnCell'), &
+                    'nc_write_model_atts', 'verticesOnCell long_name '//trim(filename))
+   
+      call nc_check(nf90_def_var(ncFileID,name='areaCell', xtype=nf90_double, &
+                    dimids=nCellsDimID, varid=VarID),&
+                    'nc_write_model_atts', 'areaCell def_var '//trim(filename))
 
-   ! Cell Longitudes
-   call nc_check(nf90_def_var(ncFileID,name='lonCell', xtype=nf90_double, &
-                 dimids=nCellsDimID, varid=VarID),&
-                 'nc_write_model_atts', 'lonCell def_var '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'cell center longitudes'), &
-                 'nc_write_model_atts', 'lonCell long_name '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'units', 'degrees_east'), &
-                 'nc_write_model_atts', 'lonCell units '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'valid_range', (/ 0.0_r8, 360.0_r8 /)), &
-                 'nc_write_model_atts', 'lonCell valid_range '//trim(filename))
+   endif ! add_static_data_to_diags
 
-   ! Cell Latitudes
-   call nc_check(nf90_def_var(ncFileID,name='latCell', xtype=nf90_double, &
-                 dimids=nCellsDimID, varid=VarID),&
-                 'nc_write_model_atts', 'latCell def_var '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'cell center latitudes'), &
-                 'nc_write_model_atts', 'latCell long_name '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'units', 'degrees_north'),  &
-                 'nc_write_model_atts', 'latCell units '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID,'valid_range',(/ -90.0_r8, 90.0_r8 /)), &
-                 'nc_write_model_atts', 'latCell valid_range '//trim(filename))
-
-   call nc_check(nf90_def_var(ncFileID,name='xCell', xtype=nf90_double, &
-                 dimids=nCellsDimID, varid=VarID),&
-                 'nc_write_model_atts', 'xCell def_var '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'cell center x cartesian coordinates'), &
-                 'nc_write_model_atts', 'xCell long_name '//trim(filename))
-
-   call nc_check(nf90_def_var(ncFileID,name='yCell', xtype=nf90_double, &
-                 dimids=nCellsDimID, varid=VarID),&
-                 'nc_write_model_atts', 'yCell def_var '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'cell center y cartesian coordinates'), &
-                 'nc_write_model_atts', 'yCell long_name '//trim(filename))
-
-   call nc_check(nf90_def_var(ncFileID,name='zCell', xtype=nf90_double, &
-                 dimids=nCellsDimID, varid=VarID),&
-                 'nc_write_model_atts', 'zCell def_var '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'cell center z cartesian coordinates'), &
-                 'nc_write_model_atts', 'zCell long_name '//trim(filename))
-
-   ! Grid vertical information
-   call nc_check(nf90_def_var(ncFileID,name='zgrid',xtype=nf90_double, &
-                 dimids=(/ nVertLevelsP1DimID, nCellsDimID /) ,varid=VarID), &
-                 'nc_write_model_atts', 'zgrid def_var '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'grid zgrid'), &
-                 'nc_write_model_atts', 'zgrid long_name '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'units', 'meters'),  &
-                 'nc_write_model_atts', 'zgrid units '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'positive', 'up'),  &
-                 'nc_write_model_atts', 'zgrid units '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'cartesian_axis', 'Z'),   &
-                 'nc_write_model_atts', 'zgrid cartesian_axis '//trim(filename))
-
-   ! Vertex Longitudes
-   call nc_check(nf90_def_var(ncFileID,name='lonVertex', xtype=nf90_double, &
-                 dimids=nVerticesDimID, varid=VarID),&
-                 'nc_write_model_atts', 'lonVertex def_var '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'vertex longitudes'), &
-                 'nc_write_model_atts', 'lonVertex long_name '//trim(filename))
-
-   ! Vertex Latitudes
-   call nc_check(nf90_def_var(ncFileID,name='latVertex', xtype=nf90_double, &
-                 dimids=nVerticesDimID, varid=VarID),&
-                 'nc_write_model_atts', 'latVertex def_var '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'vertex latitudes'), &
-                 'nc_write_model_atts', 'latVertex long_name '//trim(filename))
-
-   if(data_on_edges) then
-      ! Edge Longitudes
-      call nc_check(nf90_def_var(ncFileID,name='lonEdge', xtype=nf90_double, &
-                    dimids=nEdgesDimID, varid=VarID),&
-                    'nc_write_model_atts', 'lonEdge def_var '//trim(filename))
-      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'edge longitudes'), &
-                    'nc_write_model_atts', 'lonEdge long_name '//trim(filename))
-
-      ! Edge Latitudes
-      call nc_check(nf90_def_var(ncFileID,name='latEdge', xtype=nf90_double, &
-                    dimids=nEdgesDimID, varid=VarID),&
-                    'nc_write_model_atts', 'latEdge def_var '//trim(filename))
-      call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'edge latitudes'), &
-                    'nc_write_model_atts', 'latEdge long_name '//trim(filename))
-   endif
-
-   ! Grid relationship information
-   call nc_check(nf90_def_var(ncFileID,name='nEdgesOnCell',xtype=nf90_int, &
-                 dimids=nCellsDimID ,varid=VarID), &
-                 'nc_write_model_atts', 'nEdgesOnCell def_var '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'grid nEdgesOnCell'), &
-                 'nc_write_model_atts', 'nEdgesOnCell long_name '//trim(filename))
-
-   call nc_check(nf90_def_var(ncFileID,name='cellsOnVertex',xtype=nf90_int, &
-                 dimids=(/ VertexDegreeDimID, nVerticesDimID /) ,varid=VarID), &
-                 'nc_write_model_atts', 'cellsOnVertex def_var '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'grid cellsOnVertex'), &
-                 'nc_write_model_atts', 'cellsOnVertex long_name '//trim(filename))
-
-   call nc_check(nf90_def_var(ncFileID,name='verticesOnCell',xtype=nf90_int, &
-                 dimids=(/ maxEdgesDimID, nCellsDimID /) ,varid=VarID), &
-                 'nc_write_model_atts', 'verticesOnCell def_var '//trim(filename))
-   call nc_check(nf90_put_att(ncFileID,  VarID, 'long_name', 'grid verticesOnCell'), &
-                 'nc_write_model_atts', 'verticesOnCell long_name '//trim(filename))
-
-   call nc_check(nf90_def_var(ncFileID,name='areaCell', xtype=nf90_double, &
-                 dimids=nCellsDimID, varid=VarID),&
-                 'nc_write_model_atts', 'areaCell def_var '//trim(filename))
-
    !----------------------------------------------------------------------------
    ! Create the (empty) Prognostic Variables and the Attributes
    !----------------------------------------------------------------------------
@@ -1500,122 +1516,124 @@
 
    call nc_check(nf90_enddef(ncFileID), 'prognostic enddef '//trim(filename))
 
-   !----------------------------------------------------------------------------
-   ! Fill the coordinate variables that DART needs and has locally
-   !----------------------------------------------------------------------------
+   if (add_static_data_to_diags) then
+      !----------------------------------------------------------------------------
+      ! Fill the coordinate variables that DART needs and has locally
+      !----------------------------------------------------------------------------
 
-   call nc_check(NF90_inq_varid(ncFileID, 'lonCell', VarID), &
-                 'nc_write_model_atts', 'lonCell inq_varid '//trim(filename))
-   call nc_check(nf90_put_var(ncFileID, VarID, lonCell ), &
-                'nc_write_model_atts', 'lonCell put_var '//trim(filename))
+      call nc_check(NF90_inq_varid(ncFileID, 'lonCell', VarID), &
+                    'nc_write_model_atts', 'lonCell inq_varid '//trim(filename))
+      call nc_check(nf90_put_var(ncFileID, VarID, lonCell ), &
+                   'nc_write_model_atts', 'lonCell put_var '//trim(filename))
+   
+      call nc_check(NF90_inq_varid(ncFileID, 'latCell', VarID), &
+                    'nc_write_model_atts', 'latCell inq_varid '//trim(filename))
+      call nc_check(nf90_put_var(ncFileID, VarID, latCell ), &
+                   'nc_write_model_atts', 'latCell put_var '//trim(filename))
+   
+      if(data_on_edges) then
+         call nc_check(NF90_inq_varid(ncFileID, 'lonEdge', VarID), &
+                       'nc_write_model_atts', 'lonEdge inq_varid '//trim(filename))
+         call nc_check(nf90_put_var(ncFileID, VarID, lonEdge ), &
+                      'nc_write_model_atts', 'lonEdge put_var '//trim(filename))
+   
+         call nc_check(NF90_inq_varid(ncFileID, 'latEdge', VarID), &
+                       'nc_write_model_atts', 'latEdge inq_varid '//trim(filename))
+         call nc_check(nf90_put_var(ncFileID, VarID, latEdge ), &
+                      'nc_write_model_atts', 'latEdge put_var '//trim(filename))
+      endif
+   
+      call nc_check(NF90_inq_varid(ncFileID, 'zgrid', VarID), &
+                    'nc_write_model_atts', 'zgrid inq_varid '//trim(filename))
+      call nc_check(nf90_put_var(ncFileID, VarID, zGridFace ), &
+                   'nc_write_model_atts', 'zgrid put_var '//trim(filename))
+   
+      call nc_check(NF90_inq_varid(ncFileID, 'nEdgesOnCell', VarID), &
+                    'nc_write_model_atts', 'nEdgesOnCell inq_varid '//trim(filename))
+      call nc_check(nf90_put_var(ncFileID, VarID, nEdgesOnCell ), &
+                   'nc_write_model_atts', 'nEdgesOnCell put_var '//trim(filename))
+   
+      call nc_check(NF90_inq_varid(ncFileID, 'verticesOnCell', VarID), &
+                    'nc_write_model_atts', 'verticesOnCell inq_varid '//trim(filename))
+      call nc_check(nf90_put_var(ncFileID, VarID, verticesOnCell ), &
+                   'nc_write_model_atts', 'verticesOnCell put_var '//trim(filename))
+   
+      call nc_check(NF90_inq_varid(ncFileID, 'cellsOnVertex', VarID), &
+                    'nc_write_model_atts', 'cellsOnVertex inq_varid '//trim(filename))
+      call nc_check(nf90_put_var(ncFileID, VarID, cellsOnVertex ), &
+                   'nc_write_model_atts', 'cellsOnVertex put_var '//trim(filename))
 
-   call nc_check(NF90_inq_varid(ncFileID, 'latCell', VarID), &
-                 'nc_write_model_atts', 'latCell inq_varid '//trim(filename))
-   call nc_check(nf90_put_var(ncFileID, VarID, latCell ), &
-                'nc_write_model_atts', 'latCell put_var '//trim(filename))
-
-   if(data_on_edges) then
-      call nc_check(NF90_inq_varid(ncFileID, 'lonEdge', VarID), &
-                    'nc_write_model_atts', 'lonEdge inq_varid '//trim(filename))
-      call nc_check(nf90_put_var(ncFileID, VarID, lonEdge ), &
-                   'nc_write_model_atts', 'lonEdge put_var '//trim(filename))
-
-      call nc_check(NF90_inq_varid(ncFileID, 'latEdge', VarID), &
-                    'nc_write_model_atts', 'latEdge inq_varid '//trim(filename))
-      call nc_check(nf90_put_var(ncFileID, VarID, latEdge ), &
-                   'nc_write_model_atts', 'latEdge put_var '//trim(filename))
-   endif
-
-   call nc_check(NF90_inq_varid(ncFileID, 'zgrid', VarID), &
-                 'nc_write_model_atts', 'zgrid inq_varid '//trim(filename))
-   call nc_check(nf90_put_var(ncFileID, VarID, zGridFace ), &
-                'nc_write_model_atts', 'zgrid put_var '//trim(filename))
-
-   call nc_check(NF90_inq_varid(ncFileID, 'nEdgesOnCell', VarID), &
-                 'nc_write_model_atts', 'nEdgesOnCell inq_varid '//trim(filename))
-   call nc_check(nf90_put_var(ncFileID, VarID, nEdgesOnCell ), &
-                'nc_write_model_atts', 'nEdgesOnCell put_var '//trim(filename))
-
-   call nc_check(NF90_inq_varid(ncFileID, 'verticesOnCell', VarID), &
-                 'nc_write_model_atts', 'verticesOnCell inq_varid '//trim(filename))
-   call nc_check(nf90_put_var(ncFileID, VarID, verticesOnCell ), &
-                'nc_write_model_atts', 'verticesOnCell put_var '//trim(filename))
-
-   call nc_check(NF90_inq_varid(ncFileID, 'cellsOnVertex', VarID), &
-                 'nc_write_model_atts', 'cellsOnVertex inq_varid '//trim(filename))
-   call nc_check(nf90_put_var(ncFileID, VarID, cellsOnVertex ), &
-                'nc_write_model_atts', 'cellsOnVertex put_var '//trim(filename))
-
-   !----------------------------------------------------------------------------
-   ! Fill the coordinate variables needed for plotting only.
-   ! DART has not read these in, so we have to read them from the input file
+      !----------------------------------------------------------------------------
+      ! Fill the coordinate variables needed for plotting only.
+      ! DART has not read these in, so we have to read them from the input file
    ! and parrot them to the DART output file.
    !----------------------------------------------------------------------------
 
-   call nc_check(nf90_open(trim(grid_definition_filename), NF90_NOWRITE, mpasFileID), &
-                 'nc_write_model_atts','open '//trim(grid_definition_filename))
+      call nc_check(nf90_open(trim(grid_definition_filename), NF90_NOWRITE, mpasFileID), &
+                    'nc_write_model_atts','open '//trim(grid_definition_filename))
+   
+      allocate(data1d(nCells))
+      call nc_check(nf90_inq_varid(mpasFileID, 'xCell', VarID), &
+                    'nc_write_model_atts',     'xCell inq_varid ')
+      call nc_check(nf90_get_var(mpasFileID, VarID, data1d ), &
+                    'nc_write_model_atts',     'xCell get_var ')
+      call nc_check(nf90_inq_varid(ncFileID,   'xCell', VarID), &
+                    'nc_write_model_atts',     'xCell inq_varid '//trim(filename))
+      call nc_check(nf90_put_var(ncFileID, VarID, data1d ), &
+                    'nc_write_model_atts',     'xCell put_var '//trim(filename))
+   
+      call nc_check(nf90_inq_varid(mpasFileID, 'yCell', VarID), &
+                    'nc_write_model_atts',     'yCell inq_varid ')
+      call nc_check(nf90_get_var(mpasFileID, VarID, data1d ), &
+                    'nc_write_model_atts',     'yCell get_var ')
+      call nc_check(nf90_inq_varid(ncFileID,   'yCell', VarID), &
+                    'nc_write_model_atts',     'yCell inq_varid '//trim(filename))
+      call nc_check(nf90_put_var(ncFileID, VarID, data1d ), &
+                    'nc_write_model_atts',     'yCell put_var '//trim(filename))
+   
+      call nc_check(nf90_inq_varid(mpasFileID, 'zCell', VarID), &
+                    'nc_write_model_atts',     'zCell inq_varid ')
+      call nc_check(nf90_get_var(mpasFileID, VarID, data1d ), &
+                    'nc_write_model_atts',     'zCell get_var ')
+      call nc_check(nf90_inq_varid(ncFileID,   'zCell', VarID), &
+                    'nc_write_model_atts',     'zCell inq_varid '//trim(filename))
+      call nc_check(nf90_put_var(ncFileID, VarID, data1d ), &
+                    'nc_write_model_atts',     'zCell put_var '//trim(filename))
+   
+      call nc_check(nf90_inq_varid(mpasFileID, 'areaCell', VarID), &
+                    'nc_write_model_atts',     'areaCell inq_varid ')
+      call nc_check(nf90_get_var(mpasFileID, VarID, data1d ), &
+                    'nc_write_model_atts',     'areaCell get_var ')
+      call nc_check(nf90_inq_varid(ncFileID,   'areaCell', VarID), &
+                    'nc_write_model_atts',     'areaCell inq_varid '//trim(filename))
+      call nc_check(nf90_put_var(ncFileID, VarID, data1d ), &
+                    'nc_write_model_atts',     'areaCell put_var '//trim(filename))
+      deallocate(data1d)
+   
+      allocate(data1d(nVertices))
+      call nc_check(nf90_inq_varid(mpasFileID, 'lonVertex', VarID), &
+                    'nc_write_model_atts',     'lonVertex inq_varid ')
+      call nc_check(nf90_get_var(mpasFileID, VarID, data1d ), &
+                    'nc_write_model_atts',     'lonVertex get_var ')
+      call nc_check(nf90_inq_varid(ncFileID,   'lonVertex', VarID), &
+                    'nc_write_model_atts',     'lonVertex inq_varid '//trim(filename))
+      call nc_check(nf90_put_var(ncFileID, VarID, data1d ), &
+                    'nc_write_model_atts',     'lonVertex put_var '//trim(filename))
+   
+      call nc_check(nf90_inq_varid(mpasFileID, 'latVertex', VarID), &
+                    'nc_write_model_atts',     'latVertex inq_varid ')
+      call nc_check(nf90_get_var(mpasFileID, VarID, data1d ), &
+                    'nc_write_model_atts',     'latVertex get_var ')
+      call nc_check(nf90_inq_varid(ncFileID,   'latVertex', VarID), &
+                    'nc_write_model_atts',     'latVertex inq_varid '//trim(filename))
+      call nc_check(nf90_put_var(ncFileID, VarID, data1d ), &
+                    'nc_write_model_atts',     'latVertex put_var '//trim(filename))
+      deallocate(data1d)
+   
+      call nc_check(nf90_close(mpasFileID),'nc_write_model_atts','close '//trim(grid_definition_filename))
+   endif ! add_static_data_to_diags
+endif  ! output_state_vector
 
-   allocate(data1d(nCells))
-   call nc_check(nf90_inq_varid(mpasFileID, 'xCell', VarID), &
-                 'nc_write_model_atts',     'xCell inq_varid ')
-   call nc_check(nf90_get_var(mpasFileID, VarID, data1d ), &
-                 'nc_write_model_atts',     'xCell get_var ')
-   call nc_check(nf90_inq_varid(ncFileID,   'xCell', VarID), &
-                 'nc_write_model_atts',     'xCell inq_varid '//trim(filename))
-   call nc_check(nf90_put_var(ncFileID, VarID, data1d ), &
-                 'nc_write_model_atts',     'xCell put_var '//trim(filename))
-
-   call nc_check(nf90_inq_varid(mpasFileID, 'yCell', VarID), &
-                 'nc_write_model_atts',     'yCell inq_varid ')
-   call nc_check(nf90_get_var(mpasFileID, VarID, data1d ), &
-                 'nc_write_model_atts',     'yCell get_var ')
-   call nc_check(nf90_inq_varid(ncFileID,   'yCell', VarID), &
-                 'nc_write_model_atts',     'yCell inq_varid '//trim(filename))
-   call nc_check(nf90_put_var(ncFileID, VarID, data1d ), &
-                 'nc_write_model_atts',     'yCell put_var '//trim(filename))
-
-   call nc_check(nf90_inq_varid(mpasFileID, 'zCell', VarID), &
-                 'nc_write_model_atts',     'zCell inq_varid ')
-   call nc_check(nf90_get_var(mpasFileID, VarID, data1d ), &
-                 'nc_write_model_atts',     'zCell get_var ')
-   call nc_check(nf90_inq_varid(ncFileID,   'zCell', VarID), &
-                 'nc_write_model_atts',     'zCell inq_varid '//trim(filename))
-   call nc_check(nf90_put_var(ncFileID, VarID, data1d ), &
-                 'nc_write_model_atts',     'zCell put_var '//trim(filename))
-
-   call nc_check(nf90_inq_varid(mpasFileID, 'areaCell', VarID), &
-                 'nc_write_model_atts',     'areaCell inq_varid ')
-   call nc_check(nf90_get_var(mpasFileID, VarID, data1d ), &
-                 'nc_write_model_atts',     'areaCell get_var ')
-   call nc_check(nf90_inq_varid(ncFileID,   'areaCell', VarID), &
-                 'nc_write_model_atts',     'areaCell inq_varid '//trim(filename))
-   call nc_check(nf90_put_var(ncFileID, VarID, data1d ), &
-                 'nc_write_model_atts',     'areaCell put_var '//trim(filename))
-   deallocate(data1d)
-
-   allocate(data1d(nVertices))
-   call nc_check(nf90_inq_varid(mpasFileID, 'lonVertex', VarID), &
-                 'nc_write_model_atts',     'lonVertex inq_varid ')
-   call nc_check(nf90_get_var(mpasFileID, VarID, data1d ), &
-                 'nc_write_model_atts',     'lonVertex get_var ')
-   call nc_check(nf90_inq_varid(ncFileID,   'lonVertex', VarID), &
-                 'nc_write_model_atts',     'lonVertex inq_varid '//trim(filename))
-   call nc_check(nf90_put_var(ncFileID, VarID, data1d ), &
-                 'nc_write_model_atts',     'lonVertex put_var '//trim(filename))
-
-   call nc_check(nf90_inq_varid(mpasFileID, 'latVertex', VarID), &
-                 'nc_write_model_atts',     'latVertex inq_varid ')
-   call nc_check(nf90_get_var(mpasFileID, VarID, data1d ), &
-                 'nc_write_model_atts',     'latVertex get_var ')
-   call nc_check(nf90_inq_varid(ncFileID,   'latVertex', VarID), &
-                 'nc_write_model_atts',     'latVertex inq_varid '//trim(filename))
-   call nc_check(nf90_put_var(ncFileID, VarID, data1d ), &
-                 'nc_write_model_atts',     'latVertex put_var '//trim(filename))
-   deallocate(data1d)
-
-   call nc_check(nf90_close(mpasFileID),'nc_write_model_atts','close '//trim(grid_definition_filename))
-endif
-
 !-------------------------------------------------------------------------------
 ! Flush the buffer and leave netCDF file open
 !-------------------------------------------------------------------------------
@@ -1888,6 +1906,7 @@
 if (allocated(zGridFace))      deallocate(zGridFace)
 if (allocated(zGridCenter))    deallocate(zGridCenter)
 if (allocated(cellsOnVertex))  deallocate(cellsOnVertex)
+if (allocated(xland))          deallocate(xland)
 if (allocated(nEdgesOnCell))   deallocate(nEdgesOnCell)
 if (allocated(edgesOnCell))    deallocate(edgesOnCell)
 if (allocated(cellsOnEdge))    deallocate(cellsOnEdge)
@@ -2903,7 +2922,25 @@
 
 end subroutine get_grid_dims
 
+!------------------------------------------------------------------
 
+subroutine get_xland(Cells,LandOrNot)
+
+! public routine for returning land mask
+! Later, we may want to add more variables such as sfc_albedo.
+
+integer,  intent(in)  :: Cells
+real(r8), allocatable, intent(out) :: LandOrNot(:)
+
+integer :: i
+if ( .not. module_initialized ) call static_init_model
+
+allocate(LandOrNot(Cells))
+
+LandOrNot  = xland
+
+end subroutine get_xland
+
 !==================================================================
 ! The (model-specific) private interfaces come last
 !==================================================================
@@ -3126,6 +3163,11 @@
 call nc_check(nf90_get_var( ncid, VarID, cellsOnVertex), &
       'get_grid', 'get_var cellsOnVertex '//trim(grid_definition_filename))
 
+call nc_check(nf90_inq_varid(ncid, 'xland', VarID), &
+      'get_grid', 'inq_varid xland '//trim(grid_definition_filename))
+call nc_check(nf90_get_var( ncid, VarID, xland), &
+      'get_grid', 'get_var xland '//trim(grid_definition_filename))
+
 ! MPAS analysis files are in radians - at this point DART needs degrees.
 
 latCell = latCell * rad2deg
@@ -3243,6 +3285,7 @@
    write(*,*)'nEdgesOnCell      range ',minval(nEdgesOnCell),      maxval(nEdgesOnCell)
    write(*,*)'EdgesOnCell       range ',minval(EdgesOnCell),       maxval(EdgesOnCell)
    write(*,*)'cellsOnEdge       range ',minval(cellsOnEdge),       maxval(cellsOnEdge)
+   write(*,*)'xland             range ',minval(xland),             maxval(xland)
    if(data_on_edges) then
       write(*,*)'latEdge        range ',minval(latEdge),           maxval(latEdge)
       write(*,*)'lonEdge        range ',minval(lonEdge),           maxval(lonEdge)

Modified: DART/trunk/models/mpas_atm/mpas_dart_obs_preprocess.f90
===================================================================
--- DART/trunk/models/mpas_atm/mpas_dart_obs_preprocess.f90	2015-01-16 21:28:00 UTC (rev 7383)
+++ DART/trunk/models/mpas_atm/mpas_dart_obs_preprocess.f90	2015-01-16 21:54:30 UTC (rev 7384)
@@ -119,6 +119,9 @@
 !  surface obs. specific parameters
 logical            :: overwrite_ncep_sfc_qc    = .false.  ! true to overwrite NCEP QC (see instructions)
 
+! lowest height for GPS REFRACTIVITY (SYHA)
+real(r8)           :: gpsro_lowest_meter        = 3000.0      ! remove all obs at lower height
+
 !  overwrite or windowing obs time
 logical            :: overwrite_obs_time       = .false.  ! true to overwrite all observation times
 logical            :: windowing_obs_time       = .false.  ! true to remove obs beyond the time window
@@ -128,7 +131,7 @@
          include_sig_data, superob_aircraft, superob_sat_winds, superob_qc_threshold,   &
          sfc_elevation_check, overwrite_ncep_sfc_qc, overwrite_ncep_satwnd_qc, &
          aircraft_pres_int, sat_wind_pres_int, sfc_elevation_tol,   & 
-         obs_pressure_top, obs_height_top, sonde_extra, metar_extra,   &
+         obs_pressure_top, obs_height_top, gpsro_lowest_meter, sonde_extra, metar_extra, &
          acars_extra, land_sfc_extra, marine_sfc_extra, sat_wind_extra, profiler_extra, &
          trop_cyclone_extra, gpsro_extra, gpspw_extra, tc_sonde_radii, overwrite_obs_time, &
          windowing_obs_time, windowing_int_hour
@@ -218,61 +221,61 @@
 !  add supplimental rawinsonde observations from file
 call add_supplimental_obs(sonde_extra, seq_rawin, max_obs_seq, &
 RADIOSONDE_U_WIND_COMPONENT, include_sig_data, &
-obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
 overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
 
 !  add supplimental ACARS observations from file
 call add_supplimental_obs(acars_extra, seq_acars, max_obs_seq, &
 ACARS_U_WIND_COMPONENT, include_sig_data, &
-obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
 overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
 
 !  add supplimental marine observations from file
 call add_supplimental_obs(marine_sfc_extra, seq_sfc, max_obs_seq, &
 MARINE_SFC_U_WIND_COMPONENT, include_sig_data, &
-obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
 overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
 
 !  add supplimental land surface observations from file
 call add_supplimental_obs(land_sfc_extra, seq_sfc, max_obs_seq, &
 LAND_SFC_U_WIND_COMPONENT, include_sig_data, &
-obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
 overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
 
 !  add supplimental metar observations from file
 call add_supplimental_obs(metar_extra, seq_sfc, max_obs_seq, &
 METAR_U_10_METER_WIND, include_sig_data, &
-obs_pressure_top, obs_height_top, sfc_elevation_check, sfc_elevation_tol, &
+obs_pressure_top, obs_height_top, gpsro_lowest_meter, sfc_elevation_check, sfc_elevation_tol, &
 overwrite_obs_time, anal_time, windowing_obs_time, windowing_int_hour)
 
 !  add supplimental satellite wind observations from file
 call add_supplimental_obs(sat_wind_extra, seq_satwnd, max_obs_seq, &
 SAT_U_WIND_COMPONENT, include_sig_data, &

@@ Diff output truncated at 40000 characters. @@


More information about the Dart-dev mailing list