[Dart-dev] DART/branches Revision: 12409
dart at ucar.edu
dart at ucar.edu
Tue Feb 27 13:51:13 MST 2018
thoar at ucar.edu
2018-02-27 13:51:13 -0700 (Tue, 27 Feb 2018)
1020
Program tested and complete. Updates the variable in the input netCDF file.
The HPSS has the 'original' versions of these files - which are known to have
some unphysical slightly negative values in the solar fluxes.
These were put on the DS199.1 filesystem with the unphysical values.
[HSI]/home/thoar-> ls
/home/thoar:
CAM_DATMx80_1997_original.tar
CAM_DATMx80_1998_original.tar
...
CAM_DATMx80_2010_original.tar
Note these have the _original_ filenames. To convert these names to be consistent
with the CESM naming convention, you must run 'MakeLinks.csh'
0[2025] cheyenne2:/<3>thoar/bob > tar -tvf CAM_DATMx80_1997.tar
drwxr-xr-x thoar/ncar 0 2011-08-16 20:19 1997/
-rw-r--r-- thoar/ncar 123875684 2011-08-16 20:17 1997/CAM_DATM-01.cpl.ha2x1dx6h.1997.nc
-rw-r--r-- thoar/ncar 123875684 2011-08-16 20:17 1997/CAM_DATM-02.cpl.ha2x1dx6h.1997.nc
-rw-r--r-- thoar/ncar 123875684 2011-08-16 20:17 1997/CAM_DATM-03.cpl.ha2x1dx6h.1997.nc
The above files were put to the HPSS using 'Archive_to_HPSS.csh'
Modified: DART/branches/cesm_clm/assimilation_code/programs/forcing_check/forcing_check.f90
===================================================================
--- DART/branches/cesm_clm/assimilation_code/programs/forcing_check/forcing_check.f90 2018-02-20 22:17:09 UTC (rev 12408)
+++ DART/branches/cesm_clm/assimilation_code/programs/forcing_check/forcing_check.f90 2018-02-27 20:51:13 UTC (rev 12409)
@@ -84,10 +84,11 @@
procedure process_r4_3d
end interface
-logical :: debug = .false. ! or .true.
-logical :: fail_on_missing_field = .true. ! or .false.
-logical :: do_all_numeric_fields = .true. ! or .false.
-logical :: only_report_differences = .true. ! or .false.
+logical :: debug = .false.
+logical :: fail_on_missing_field = .true.
+logical :: do_all_numeric_fields = .true.
+logical :: only_report_differences = .true.
+
character(len=NF90_MAX_NAME) :: fieldnames(1000) = '' ! something large
character(len=256) :: fieldlist_file = ''
@@ -114,6 +115,11 @@
if (debug) then
call error_handler(E_MSG, routine, ' debug on')
endif
+if (only_report_differences) then
+ call error_handler(E_MSG, routine, ' Only reporting the differences, not changing anything.')
+else
+ call error_handler(E_MSG, routine, ' Potentially modifying the input file with non-negative replacments.')
+endif
! whether to fail or just warn if a field is not found
if (fail_on_missing_field) then
@@ -122,8 +128,7 @@
etype = E_MSG
endif
-! check inputs - get a string from stdin
-! eg: echo infile1.nc | ./forcing_check
+! get filename from stdin. eg: echo infile1.nc | ./forcing_check
read(*, '(A)') argline
call get_args_from_string(argline, argcount, argwords)
@@ -157,18 +162,13 @@
endif
! open the files
-ncrc = nf90_open(infile1, NF90_NOWRITE, ncid)
+ncrc = nf90_open(infile1, NF90_WRITE, ncid)
call nc_check(ncrc, routine, 'nf90_open', infile1)
ncrc = nf90_inquire(ncid, nin1Dimensions, nin1Variables, &
- nin1Attributes, in1unlimitedDimID)
+ nin1Attributes, in1unlimitedDimID)
call nc_check(ncrc, routine, 'nf90_inquire', infile1)
-! for now, loop over the number of vars in file 1. at some point we
-! should print out vars that are in 1 but not 2, and in 2 but not 1.
-! but for that we need more logic to track which vars are processed.
-! this code loops over the names in file 1 and finds them (or not)
-! in file 2 but doesn't complain about unused vars in file 2.
nvars = nin1Variables
if (debug) then
@@ -177,8 +177,7 @@
call error_handler(E_MSG, routine, string1)
endif
-! input files to get data from
-! list of netcdf fields to compare
+! list of variables to check
fieldloop : do i=1, nvars
@@ -188,6 +187,7 @@
call nc_check(ncrc, routine, 'nf90_inquire_variable', nextfield, infile1)
else
if (from_file) then
+ ! In this case, get_next_variable_name ...
nextfield = get_next_filename(fieldlist_file, i)
else
nextfield = fieldnames(i)
@@ -299,19 +299,19 @@
allocate(ioned1(dimlen(1)))
ncrc = nf90_get_var(ncid, varID, ioned1)
call nc_check(ncrc, routine, 'nf90_get_var', nextfield, infile1)
- call process(nextfield, ioned1, nitems)
+ call process(ncid, varID, nextfield, ioned1, nitems)
deallocate(ioned1)
case (2)
allocate(itwod1(dimlen(1),dimlen(2)))
ncrc = nf90_get_var(ncid, varID, itwod1)
call nc_check(ncrc, routine, 'nf90_get_var', nextfield, infile1)
- call process(nextfield, itwod1, nitems)
+ call process(ncid, varID, nextfield, itwod1, nitems)
deallocate(itwod1)
case (3)
allocate(ithreed1(dimlen(1),dimlen(2),dimlen(3)))
ncrc = nf90_get_var(ncid, varID, ithreed1)
call nc_check(ncrc, routine, 'nf90_get_var', nextfield, infile1)
- call process(nextfield, ithreed1, nitems)
+ call process(ncid, varID, nextfield, ithreed1, nitems)
More information about the Dart-dev
mailing list