[Dart-dev] DART/branches Revision: 11597
dart at ucar.edu
dart at ucar.edu
Wed May 3 16:58:51 MDT 2017
nancy at ucar.edu
2017-05-03 16:58:51 -0600 (Wed, 03 May 2017)
286
make the default conversion return success instead
of failure. this makes everyone happy.
make the nc_write_location_atts create a vertical
variable if the underlying locations mod has choices
in the vertical. then the calling code doesn't
need to be aware of the location details.
Modified: DART/branches/model_mod_changes/assimilation_code/location/threed_sphere/location_mod.f90
===================================================================
--- DART/branches/model_mod_changes/assimilation_code/location/threed_sphere/location_mod.f90 2017-05-03 22:56:51 UTC (rev 11596)
+++ DART/branches/model_mod_changes/assimilation_code/location/threed_sphere/location_mod.f90 2017-05-03 22:58:51 UTC (rev 11597)
@@ -1137,7 +1137,7 @@
integer, intent(in) :: which_vert
integer, intent(out) :: status(:)
-status(:) = 1
+status(:) = 0
end subroutine convert_vertical_obs
@@ -1154,7 +1154,7 @@
integer, intent(in) :: which_vert
integer, intent(out) :: istatus
-istatus = 1
+istatus = 0
end subroutine convert_vertical_state
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-05-03 22:56:51 UTC (rev 11596)
+++ DART/branches/model_mod_changes/assimilation_code/location/utilities/location_io_mod.f90 2017-05-03 22:58:51 UTC (rev 11597)
@@ -76,15 +76,26 @@
integer :: rc
character(len=32) :: context = 'nc_write_location_atts'
+! get an id for the locations dimension:
+! if the user passes us in a dimension id,
+! assume it is already created and use it.
+! if they pass in a valid length, create a 'location' dimension.
+! otherwise, use the unlimited dimension
-! define the rank/dimension of the location information.
-! an initial size of 0 signals we are using the unlimited dim
-! and don't need to define a separate one.
-if (dimlen /= 0) then
+if (present(use_dimID)) then
+ LocDimID = use_dimID
+
+else if (dimlen /= 0) then
rc = nf90_def_dim(ncid=ncFileID, name='location', len=dimlen, dimid=LocDimID)
call nc_check(rc, context, 'def_dim:location', fname)
+
+else
+ rc = nf90_inquire(ncFileID, UnlimitedDimID=LocDimID)
+ call nc_check(rc, context, 'inquire:unlimited_dim', fname)
endif
+! if there is more than a single number associated with each location
+! define the dimension "across" the locations. e.g. len 3 for 3d dimensions.
if (LocationDims > 1) then
rc = nf90_def_dim(ncid=ncFileID, name='locdim', len=LocationDims, dimid=LDimID)
call nc_check(rc, context, 'def_dim:locdim', fname)
@@ -93,25 +104,13 @@
! Define the location variable and attributes
if (LocationDims > 1) then
- if (present(use_dimID)) then
- rc = nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
- dimids=(/ LDimID, use_dimID /), varid=VarID)
- call nc_check(rc, context, 'def_var1:location', fname)
- else
- rc = nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
- dimids=(/ LDimID, LocDimID /), varid=VarID)
- call nc_check(rc, context, 'def_var2:location', fname)
- endif
+ rc = nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
+ dimids=(/ LDimID, LocDimID /), varid=VarID)
+ call nc_check(rc, context, 'def_var2:location', fname)
else
- if (present(use_dimID)) then
- rc = nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
- dimids=(/ use_dimID /), varid=VarID)
- call nc_check(rc, context, 'def_var3:location', fname)
- else
- rc = nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
- dimids=(/ LocDimID /), varid=VarID)
- call nc_check(rc, context, 'def_var4:location', fname)
- endif
+ rc = nf90_def_var(ncFileID, 'location', xtype=nf90_double, &
+ dimids=(/ LocDimID /), varid=VarID)
+ call nc_check(rc, context, 'def_var4:location', fname)
endif
rc = nf90_put_att(ncFileID, VarID, 'description', 'location coordinates')
@@ -129,29 +128,47 @@
rc = nf90_put_att(ncFileID, VarID, 'units', trim(LocationUnits))
call nc_check(rc, context, 'put_att:units', fname)
+! if there is more than a single option for the vertical,
+! create a variable to store the vert choice
+
+if (has_vertical_choice()) then
+ call nc_write_location_vert(ncFileID, LocDimID, fname)
+endif
+
More information about the Dart-dev
mailing list