[Dart-dev] [6094] DART/branches/development/models/mpas_ocn/model_mod_check.f90: removed some mpas atm remnants, added the right kinds for the ocean.
nancy at ucar.edu
nancy at ucar.edu
Fri Apr 26 16:32:41 MDT 2013
Revision: 6094
Author: nancy
Date: 2013-04-26 16:32:40 -0600 (Fri, 26 Apr 2013)
Log Message:
-----------
removed some mpas atm remnants, added the right kinds for the ocean.
Modified Paths:
--------------
DART/branches/development/models/mpas_ocn/model_mod_check.f90
-------------- next part --------------
Modified: DART/branches/development/models/mpas_ocn/model_mod_check.f90
===================================================================
--- DART/branches/development/models/mpas_ocn/model_mod_check.f90 2013-04-26 20:54:19 UTC (rev 6093)
+++ DART/branches/development/models/mpas_ocn/model_mod_check.f90 2013-04-26 22:32:40 UTC (rev 6094)
@@ -24,7 +24,16 @@
VERTISUNDEF, VERTISSURFACE, VERTISLEVEL, VERTISPRESSURE, &
VERTISHEIGHT, VERTISSCALEHEIGHT
use obs_kind_mod, only : get_raw_obs_kind_name, get_raw_obs_kind_index, &
- KIND_U_WIND_COMPONENT, KIND_V_WIND_COMPONENT
+ KIND_POTENTIAL_TEMPERATURE, &
+ KIND_TEMPERATURE, &
+ KIND_SALINITY, &
+ KIND_DRY_LAND, &
+ KIND_EDGE_NORMAL_SPEED, &
+ KIND_U_CURRENT_COMPONENT, &
+ KIND_V_CURRENT_COMPONENT, &
+ KIND_SEA_SURFACE_HEIGHT, &
+ KIND_SEA_SURFACE_PRESSURE, &
+ KIND_TRACER_CONCENTRATION
use assim_model_mod, only : open_restart_read, open_restart_write, close_restart, &
aread_state_restart, awrite_state_restart, &
netcdf_file_type, aoutput_diagnostics, &
@@ -66,10 +75,10 @@
integer :: x_ind = -1
real(r8) :: interp_test_dlon = 1.0
real(r8) :: interp_test_dlat = 1.0
-real(r8) :: interp_test_dvert = 1.0
+real(r8) :: interp_test_dvert = 100.0
real(r8), dimension(2) :: interp_test_latrange = (/ -90.0, 90.0 /)
real(r8), dimension(2) :: interp_test_lonrange = (/ 0.0, 360.0 /)
-real(r8), dimension(2) :: interp_test_vertrange = (/ 1000.0, 30000.0 /)
+real(r8), dimension(2) :: interp_test_vertrange = (/ 10.0, 6010.0 /)
real(r8), dimension(3) :: loc_of_interest = -1.0_r8
character(len=metadatalength) :: kind_of_interest = 'ANY'
character(len=metadatalength) :: interp_test_vertcoord = 'VERTISHEIGHT'
@@ -311,24 +320,6 @@
call print_time( model_time,'model_mod_check:model time')
!----------------------------------------------------------------------
-! Exhaustive test of the interpolation code.
-! Read an existing analysis file and get the normal vectors.
-! Interpolate them to the cell centers and OVERWRITE the
-! double uReconstructMeridional(Time, nCells, nVertLevels) ;
-! double uReconstructZonal( Time, nCells, nVertLevels) ;
-! contents so we can ncdiff with the original.
-! At this point, the statevector is global ...
-!----------------------------------------------------------------------
-
-if (test1thru < 11) goto 999
-
-write(*,*)
-write(*,*)'Predicting on grid centers from edges'
-
-call interpolate_to_center()
-
-
-!----------------------------------------------------------------------
! This must be the last few lines of the main program.
!----------------------------------------------------------------------
@@ -628,150 +619,4 @@
-
-subroutine interpolate_to_center()
-! The u(Time, nEdges, nVertLevels) variable should already be in the DART state
-! vector. We are reading in the locations of the cell centers and predicting the
-! double uReconstructMeridional(Time, nCells, nVertLevels) ;
-! double uReconstructZonal(Time, nCells, nVertLevels) ;
-! values and OVERWRITING the values in the 'destroy_file' ...
-! This should allow us to easily create a difference file and plot that ...
-!
-
-integer :: ncid, dimid, VarID, uVarID, vVarID
-integer :: nCells, nVertLevelsP1, nVertLevels, xloc, zloc
-integer :: nFailedU, nFailedV
-real(r8), allocatable, dimension(:) :: lonCell, latCell
-real(r8), allocatable, dimension(:,:) :: zGridFace, zGridCenter, uhat, vhat
-
-character(len=8) :: crdate ! needed by F90 DATE_AND_TIME intrinsic
-character(len=10) :: crtime ! needed by F90 DATE_AND_TIME intrinsic
-character(len=5) :: crzone ! needed by F90 DATE_AND_TIME intrinsic
-integer, dimension(8) :: values ! needed by F90 DATE_AND_TIME intrinsic
-
-call nc_check( nf90_open(trim(destroy_file), NF90_WRITE, ncid), 'interpolate_to_center', 'open '//trim(destroy_file))
-
-! Get required dimensions
-
-call nc_check(nf90_inq_dimid(ncid, 'nCells', dimid), &
- 'interpolate_to_center','inq_dimid nCells '//trim(destroy_file))
-call nc_check(nf90_inquire_dimension(ncid, dimid, len=nCells), &
- 'interpolate_to_center','inquire_dimension nCells '//trim(destroy_file))
-
-call nc_check(nf90_inq_dimid(ncid, 'nVertLevelsP1', dimid), &
- 'interpolate_to_center','inq_dimid nVertLevelsP1 '//trim(destroy_file))
-call nc_check(nf90_inquire_dimension(ncid, dimid, len=nVertLevelsP1), &
- 'interpolate_to_center','inquire_dimension nVertLevelsP1 '//trim(destroy_file))
-
-call nc_check(nf90_inq_dimid(ncid, 'nVertLevels', dimid), &
- 'interpolate_to_center','inq_dimid NVertLevels '//trim(destroy_file))
-call nc_check(nf90_inquire_dimension(ncid, dimid, len=nVertLevels), &
- 'interpolate_to_center','inquire_dimension NVertLevels '//trim(destroy_file))
-
-allocate(lonCell(nCells), latCell(nCells))
-allocate(zGridFace(nVertLevelsP1, nCells))
-allocate(zGridCenter(nVertLevels, nCells))
-allocate( uhat(nVertLevels, nCells))
-allocate( vhat(nVertLevels, nCells))
-
-call nc_check(nf90_inq_varid(ncid, "lonCell", VarID), &
- 'interpolate_to_center', 'inq_varid lonCell'//trim(destroy_file))
-call nc_check(nf90_get_var( ncid, VarID, lonCell), &
- 'interpolate_to_center', 'get_var lonCell'//trim(destroy_file))
-call nc_check(nf90_inq_varid(ncid, "latCell", VarID), &
- 'interpolate_to_center', 'inq_varid latCell'//trim(destroy_file))
-call nc_check(nf90_get_var( ncid, VarID, latCell), &
- 'interpolate_to_center', 'get_var latCell'//trim(destroy_file))
-call nc_check(nf90_inq_varid(ncid, 'zgrid', VarID), &
- 'interpolate_to_center', 'inq_varid zgrid '//trim(destroy_file))
-call nc_check(nf90_get_var( ncid, VarID, zGridFace), &
- 'interpolate_to_center', 'get_var zgrid '//trim(destroy_file))
-
-! compute vertical center locations
-do xloc=1, nCells
-do zloc=1, nVertLevels
- zGridCenter(zloc,xloc) = (zGridFace(zloc,xloc) + zGridFace(zloc+1,xloc))*0.5_r8
-enddo
-enddo
-
-latCell(:) = rad2deg*latCell
-lonCell(:) = rad2deg*lonCell
-uhat(:,:) = MISSING_R8
-vhat(:,:) = MISSING_R8
-
-nFailedU = 0
-nFailedV = 0
-
-! FIXME : make sure zgrid is VERTISHEIGHT
-do xloc = 1, nCells
-do zloc = 1, nVertLevels
- loc = set_location(lonCell(xloc),latCell(xloc), zGridCenter(zloc,xloc), VERTISHEIGHT)
- call model_interpolate(statevector, loc, KIND_U_WIND_COMPONENT, uhat(zloc,xloc), ios_out)
- if (ios_out /= 0) nFailedU = nFailedU + 1
- call model_interpolate(statevector, loc, KIND_V_WIND_COMPONENT, vhat(zloc,xloc), ios_out)
- if (ios_out /= 0) nFailedV = nFailedV + 1
-enddo
-if (mod(xloc, 100) == 0) then
- print *, 'finished interpolating ', xloc, ' of ', nCells, ' cells'
-endif
-enddo
-
-write(*,*)'uReconstructed interpolations ',nCells*nVertLevels,'possible.'
-write(*,*)' zonal: ',nFailedU,'failures'
-write(*,*)' meridional: ',nFailedV,'failures'
-
-! Grab the variable ID and replace ...
-
-write(*,*)'Overwriting uReconstructZonal,uReconstructMeridional in '//trim(destroy_file)
-call nc_check(nf90_redef(ncid),'interpolate_to_center','redef '//trim(destroy_file))
-
-call DATE_AND_TIME(crdate,crtime,crzone,values)
-write(string1,'(''YYYY MM DD HH MM SS = '',i4,5(1x,i2.2))') &
- values(1), values(2), values(3), values(5), values(6), values(7)
-
-call nc_check( nf90_put_att(ncid, NF90_GLOBAL, 'DART_time' ,trim(string1) ), &
- 'interpolate_to_center', 'creation put '//trim(destroy_file))
-
-call nc_check(nf90_inq_varid(ncid, 'uReconstructZonal', uVarID), &
- 'interpolate_to_center', 'inq_varid uReconstructZonal '//trim(destroy_file))
-call nc_check(nf90_put_att(ncid, uVarID, 'history', 'interpolated by DART'), &
- 'interpolate_to_center', 'uReconstructZonal put_att history '//trim(destroy_file))
-call nc_check(nf90_put_att(ncid, uVarID, 'parent_file', mpas_input_file ), &
- 'interpolate_to_center', 'uReconstructZonal put_att parent_file '//trim(destroy_file))
-call nc_check(nf90_put_att(ncid, uVarID, '_FillValue', MISSING_R8), &
- 'interpolate_to_center', 'uReconstructZonal put_att FillValue '//trim(destroy_file))
-call nc_check(nf90_put_att(ncid, uVarID, 'missing_value', MISSING_R8), &
- ' interpolate_to_center', 'uReconstructZonal put_att missing_value '//trim(destroy_file))
-
-call nc_check(nf90_inq_varid(ncid, 'uReconstructMeridional', vVarID), &
- 'interpolate_to_center', 'inq_varid uReconstructMeridional '//trim(destroy_file))
-call nc_check(nf90_put_att(ncid, vVarID, 'history', 'interpolated by DART'), &
- 'interpolate_to_center', 'uReconstructMeridional put_att history '//trim(destroy_file))
-call nc_check(nf90_put_att(ncid, vVarID, 'parent_file', mpas_input_file ), &
- 'interpolate_to_center', 'uReconstructMeridional put_att parent_file '//trim(destroy_file))
-call nc_check(nf90_put_att(ncid, vVarID, '_FillValue', MISSING_R8), &
- 'interpolate_to_center', 'uReconstructMeridional put_att FillValue '//trim(destroy_file))
-call nc_check(nf90_put_att(ncid, vVarID, 'missing_value', MISSING_R8), &
- ' interpolate_to_center', 'uReconstructMeridional put_att missing_value '//trim(destroy_file))
-
-! Leave define mode so we can fill the variables.
-call nc_check(nf90_enddef(ncid), 'interpolate_to_center','enddef '//trim(destroy_file))
-
-! Fill the variables, replacing the first time step
-! The start/count arrays are in C-order ... i.e. opposite to the Fortran shape declarations.
-! FIXME ... should match the timestep of the parent file ... which hopefully only has one timestep.
-
-call nc_check(nf90_put_var( ncid, uVarID, uhat, start = (/ 1,1,1 /), count=(/ nVertLevels,nCells,1 /)), &
- 'interpolate_to_center', 'put_var uReconstructZonal '//trim(destroy_file))
-call nc_check(nf90_put_var( ncid, vVarID, vhat, start = (/ 1,1,1 /), count=(/ nVertLevels,nCells,1 /)), &
- 'interpolate_to_center', 'put_var uReconstructMeridional '//trim(destroy_file))
-
-! tidy up
-call nc_check(nf90_close(ncid), 'interpolate_to_center','close '//trim(destroy_file))
-
-deallocate(lonCell, latCell, uhat, vhat, zGridFace, zGridCenter)
-
-end subroutine interpolate_to_center
-
-
end program model_mod_check
More information about the Dart-dev
mailing list