[Dart-dev] DART/branches Revision: 11415
dart at ucar.edu
dart at ucar.edu
Wed Mar 29 17:03:03 MDT 2017
nancy at ucar.edu
2017-03-29 17:03:03 -0600 (Wed, 29 Mar 2017)
145
get the right version of the location_io_mod, and make
assim_tools have the option to call convert_vertical on
the model_state - needs testing.
Modified: DART/branches/model_mod_changes/assimilation_code/location/utilities/location_io_mod.f90
===================================================================
--- DART/branches/model_mod_changes/assimilation_code/location/utilities/location_io_mod.f90 2017-03-29 23:02:13 UTC (rev 11414)
+++ DART/branches/model_mod_changes/assimilation_code/location/utilities/location_io_mod.f90 2017-03-29 23:03:03 UTC (rev 11415)
@@ -4,9 +4,10 @@
!
! $Id$
-!> common routines used no matter which location module compiled with
+!> common routines which can write netcdf arrays no matter which
+!> location module is compiled in.
-!>@todo FIXME define ALL the VERTISXXX her, add a call to has_vert_choice
+!>@todo FIXME define ALL the VERTISXXX here, add a call to has_vertical_choice
!>to the xxx/location_mod, and if no, return without needing routines
!>in each of the specific location routines. if yes, call query and
!>match it with the type to return true/false. remove vert_is_xxx from
@@ -14,31 +15,18 @@
!>will have to replicate the VERTISxxx in the location modules because
!>fortran doesn't allow circular 'use's between modules. ugh.
-!> the key for the netcdf routines is this sits above the location routines.
-!> but that makes a circular dep for VERTIS... if they are here it forces
-!> a consistent set of values and removes all the vert_is_xxx routines from
-!> modules that don't have any vert choices. but you have to replicate the
-!> parameters since you can't have this code use the publics and have the
-!> specific location_mods use VERTISxxx from here. and depending on which
-!> specific module you use, only some or possibly none of the VERTs are defined.
-!> best we can do, i guess. fortran sucks sometimes.
+module location_io_mod
-!> can we do something about get_close here? simplify the code for
-!> modules which don't have variable vertical options?
+use types_mod, only : r8, MISSING_I
+use netcdf_utilities_mod, only : nc_check
-module location_utilitiess_mod
+!>@todo FIXME: should there be accessor functions for 5 LocationXXX variables below?
+use location_mod, only : location_type, get_location, &
+ LocationDims, LocationName, LocationLName, &
+ LocationStorageOrder, LocationUnits, &
+ has_vertical_choice, query_location
-use types_mod, only : r8, MISSING_R8, MISSING_I, PI, RAD2DEG, DEG2RAD, OBSTYPELENGTH
-use utilities_mod, only : error_handler, E_ERR, nc_check, E_MSG
-!>@todo FIXME: there should be accessor functions for 5 LocationXXX variables below.
-use location_mod, only: location_type, get_location, &
- LocationDims, LocationName, LocationLName, &
- LocationStorageOrder, LocationUnits, has_vert_choice, &
- vert_is_height, vert_is_pressure, vert_is_undef, vert_is_level, &
- vert_is_surface, vert_is_scale_height, query_location
-
-
use typeSizes
use netcdf
@@ -45,8 +33,8 @@
implicit none
private
-public :: nc_write_location_atts, nc_get_location_varids, nc_write_location, &
- nc_write_location_vert, has_vert_choice
+public :: nc_write_location_atts, nc_get_location_varids, &
+ nc_write_location, nc_write_location_vert
! version controlled file description for error handling, do not edit
character(len=256), parameter :: source = &
@@ -74,15 +62,19 @@
!----------------------------------------------------------------------------
!> Create and add attributes to a 'location' dimension and variable.
-subroutine nc_write_location_atts( ncFileID, fname, unlimDimID )
+subroutine nc_write_location_atts( ncFileID, fname, use_unlimited_dim )
integer, intent(in) :: ncFileID ! handle to the netcdf file
character(len=*), intent(in) :: fname ! file name (for printing purposes)
-integer, optional, intent(in) :: unlimDimID ! handle to the dimension that grows
+logical, optional, intent(in) :: use_unlimited_dim ! if true, query and use unlimdim
-integer :: LocDimID
-integer :: VarID
+integer :: unlimDimID, LocDimID, VarID
+logical :: unlimited
+
+unlimited = .false.
+if (present(use_unlimited_dim)) unlimited = use_unlimited_dim
+
! define the rank/dimension of the location information
call nc_check(nf90_def_dim(ncid=ncFileID, name='location', len=LocationDims, &
dimid = LocDimID), 'nc_write_location_atts', 'def_dim:location '//trim(fname))
@@ -89,7 +81,10 @@
! Define the location variable and attributes
-if (present(unlimDimID)) then
+if (unlimited) then
+ call nc_check(nf90_Inquire(ncFileID, unlimitedDimId=unlimDimID), &
+ 'nc_write_model_atts', 'nf90_Inquire')
+
More information about the Dart-dev
mailing list