[Dart-dev] DART/branches Revision: 12445
dart at ucar.edu
dart at ucar.edu
Wed Mar 14 13:36:43 MDT 2018
thoar at ucar.edu
2018-03-14 13:36:43 -0600 (Wed, 14 Mar 2018)
454
Creates both forecast and analysis names every time since they
will both be needed by trans_dart_to_coamps. For example, the names change from:
coamps_2012010100.hdf5
uuwind_sig_031050_000010_1a0067x0037_2012010606_00060000_fcstfld to
coamps_2012010106.hdf5
uuwind_sig_031050_000010_1a0067x0037_2012010606_00000000_analfld
DART creates output files with the original DTG in the name.
They should have the original DTG plus the '&convert.nml:icycle'
Modified: DART/branches/coamps/models/coamps_nest/coamps_nest_mod.f90
===================================================================
--- DART/branches/coamps/models/coamps_nest/coamps_nest_mod.f90 2018-03-14 17:18:14 UTC (rev 12444)
+++ DART/branches/coamps/models/coamps_nest/coamps_nest_mod.f90 2018-03-14 19:36:43 UTC (rev 12445)
@@ -226,6 +226,8 @@
character(len=*), parameter :: revision = "$Revision$"
character(len=*), parameter :: revdate = "$Date$"
+ character(len=512) :: string1, string2, string3
+
!------------------------------
! END MODULE VARIABLES
!------------------------------
@@ -269,7 +271,7 @@
nest%nest_level = int(datahd(DATAHD_NEST_LEVEL + nest_offset))
call initialize_list(nest%child_nests)
-call read_geographic_data(filename, nest, dtg)
+call read_terrain_height(filename, nest, dtg)
nullify(nest%iminf)
nullify(nest%imaxf)
@@ -1174,6 +1176,59 @@
!> INOUT nest The nest to add terrain data to
!> IN dtg COAMPS date-time group
+subroutine read_terrain_height(filename, nest, dtg)
+
+character(len=*), intent(in) :: filename
+type(coamps_nest), intent(inout) :: nest
+character(len=*), intent(in) :: dtg
+
+character(len=*), parameter :: routine = 'read_terrain_height'
+
+character(len=64) :: terrht_name
+character(len=64) :: longitude_name
+character(len=64) :: latitude_name
+integer :: terrht_unit, VarID
+integer :: io
+integer :: alloc_status
+integer :: dealloc_status
+
+! Permanent storage
+nullify(nest%terrain)
+allocate(nest%terrain(nest%pts_x, nest%pts_y), stat = alloc_status)
+call check_alloc_status(alloc_status, routine, source, revision, &
+ revdate, 'nest terrain')
+
+! actually generate the VARIABLE name in the HDF5 file.
+call generate_sfc_varname(nest, dtg, 'terrht', terrht_name)
+
+io = nf90_open(filename, NF90_NOWRITE, terrht_unit)
+call nc_check(io, routine, 'opening "',trim(filename),'"')
+
+write(string1,'(A)')'"'//trim(terrht_name)//'" from "'//trim(filename)//'"'
+
+io = nf90_inq_varid(terrht_unit, terrht_name, VarID)
+call nc_check(io, routine, 'inquire "'//trim(terrht_name)//'"')
+io = nf90_get_var(terrht_unit, VarID, nest%terrain)
+call nc_check(io, routine, 'get_var '//trim(string1))
+
+io = nf90_close(terrht_unit)
+call nc_check(io, routine, 'closing "'//trim(filename)//'"')
+
+! String1 has to be different to print nicely, given error_handler() nuances.
+write(string1,100)'... nest',nest%id,' terrain range',minval(nest%terrain), maxval(nest%terrain)
+call error_handler(E_MSG,routine,string1)
+
+100 format(A,1x,I2,1x,A,2(1x,f12.4))
+
+end subroutine read_terrain_height
+
+!-----------------------------------------------------------------------
+!> Reads the terrain height, latitude and longitude for a given nest
+!> and date-time group.
+!> PARAMETERS
+!> INOUT nest The nest to add terrain data to
+!> IN dtg COAMPS date-time group
+
subroutine read_geographic_data(filename, nest, dtg)
character(len=*), intent(in) :: filename
@@ -1189,7 +1244,6 @@
integer :: io
integer :: alloc_status
integer :: dealloc_status
-character(len=512) :: string0, string1, string2, string3
! Permanent storage
nullify(nest%terrain)
@@ -1291,6 +1345,14 @@
end do
end do
+! String1 has to be different to print nicely, given error_handler() nuances.
+write(string1,100)'... nest',nest%id,' terrain range',minval(nest%terrain), maxval(nest%terrain)
+write(string2,100)'nest',nest%id,' latitude range',minval(nest%lat), maxval(nest%lat)
+write(string3,100)'nest',nest%id,'longitude range',minval(nest%lon), maxval(nest%lon)
+call error_handler(E_MSG,routine,string1,text2=string2,text3=string3)
+
+100 format(A,1x,I2,1x,A,2(1x,f12.4))
More information about the Dart-dev
mailing list