Skip to content

Commit

Permalink
Merge pull request #313 from NCAR/SWE_repartition_fix
Browse files Browse the repository at this point in the history
Add SWE repartitioning for CLM
  • Loading branch information
hkershaw-brown committed Feb 3, 2022
2 parents 2caa99d + 9e65ce9 commit c4de64f
Show file tree
Hide file tree
Showing 118 changed files with 13,874 additions and 4,706 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ restart_file_tool
system_simulation
rttov_test
rttov_unit_tests
dart_to_clm
clm_to_dart

# Directories to NOT IGNORE ... same as executable names
# as far as I know, these must be listed after the executables
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ individual files.

The changes are now listed with the most recent at the top.

**February 3 2022 :: CLM with SWE repartitioning. Tag: v9.13.0**

- Updated Community Land Model (CLM) model_mod, scripting, and diagnostics.
- New capability to repartition snow layer mass and dimension variables.
The repartitioning ensures that the adjustments applied to the snow layers
are consistent (mass and dimensions are conserved) with the adjustment of
the total snow water equivalent.
- New observation converters for NASA_Earthdata and NSIDC
- Support for netcdf _FillValue
- Bug-fix for clm nc_write_model_atts lon vs nlon

**January 11 2022 :: Bug fix for inflation namelist options. Tag: v9.12.1**

- reverted inf_flavor namelist option to be integer only to conform to Fortran
Expand Down
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,10 @@ References
observations/obs_converters/MODIS/readme
observations/obs_converters/MODIS/MOD15A2_to_obs
observations/obs_converters/MPD/README
observations/obs_converters/NASA_Earthdata/README
observations/obs_converters/NCEP/prep_bufr/prep_bufr
observations/obs_converters/NCEP/ascii_to_obs/create_real_obs
observations/obs_converters/NSIDC/SMAP_L2_to_obs
observations/obs_converters/ROMS/ROMS
observations/obs_converters/SIF/SIF_to_obs_netcdf
observations/obs_converters/SSEC/SSEC
Expand Down Expand Up @@ -371,6 +373,8 @@ References
models/CESM/readme
models/cice/readme
models/clm/readme
models/clm/clm_to_dart
models/clm/dart_to_clm
models/cm1/readme
models/coamps_nest/readme
models/coamps/readme
Expand Down
36 changes: 35 additions & 1 deletion assimilation_code/modules/io/direct_netcdf_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ module direct_netcdf_mod
get_units, get_long_name, get_short_name, &
get_has_missing_value, get_FillValue, &
get_missing_value, get_add_offset, get_xtype, &
get_has_FillValue, &
get_index_start, get_index_end , get_num_dims, &
create_diagnostic_structure, &
end_diagnostic_structure
Expand Down Expand Up @@ -1725,7 +1726,8 @@ subroutine write_variable_attributes(filename, ncFileID, ncVarID, domid, &
endif

! check to see if template file has missing value attributes
if ( get_has_missing_value(domid, varid) ) then
if ( get_has_missing_value(domid, varid) .or. &
get_has_FillValue( domid, varid) ) then
select case ( get_xtype(domid, varid) )
case ( NF90_INT )
call nc_write_missing_value_int(ncFileID, filename, ncVarID, domid, varid)
Expand Down Expand Up @@ -3033,6 +3035,22 @@ subroutine set_dart_missing_value(array, domain, variable)

endif

if ( get_has_FillValue(domain, variable) ) then

select case ( get_xtype(domain, variable) )
case ( NF90_INT )
call get_FillValue(domain, variable, model_missing_valueINT)
where(array == model_missing_valueINT) array = MISSING_R8
case ( NF90_FLOAT )
call get_FillValue(domain, variable, model_missing_valueR4)
where(array == model_missing_valueR4) array = MISSING_R8
case ( NF90_DOUBLE )
call get_FillValue(domain, variable, model_missing_valueR8)
where(array == model_missing_valueR8) array = MISSING_R8
end select

endif

end subroutine set_dart_missing_value

!--------------------------------------------------------
Expand Down Expand Up @@ -3066,6 +3084,22 @@ subroutine set_model_missing_value(array, domain, variable)

endif

if ( get_has_FillValue(domain, variable) ) then

select case ( get_xtype(domain, variable) )
case ( NF90_INT )
call get_FillValue(domain, variable, model_missing_valueINT)
where(array == MISSING_R8) array = model_missing_valueINT
case ( NF90_FLOAT )
call get_FillValue(domain, variable, model_missing_valueR4)
where(array == MISSING_R8) array = model_missing_valueR4
case ( NF90_DOUBLE )
call get_FillValue(domain, variable, model_missing_valueR8)
where(array == MISSING_R8) array = model_missing_valueR8
end select

endif

end subroutine set_model_missing_value

!--------------------------------------------------------
Expand Down
28 changes: 22 additions & 6 deletions assimilation_code/modules/io/io_filenames_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module io_filenames_mod
get_add_offset, &
get_scale_factor, &
get_has_missing_value, &
get_has_FillValue, &
do_io_update
use ensemble_manager_mod, only : ensemble_type
use netcdf_utilities_mod, only : nc_check
Expand Down Expand Up @@ -632,24 +633,39 @@ subroutine check_attributes(ncFile, filename, ncVarId, domid, varid)
if ( get_has_missing_value(domid, varid) ) then
select case (get_xtype(domid,varid))
case (NF90_INT)
call get_FillValue(domid, varid, spvalINT)
call check_attribute_value_int(ncFile, filename, ncVarID, '_FillValue', spvalINT)
call get_missing_value(domid, varid, spvalINT)
call check_attribute_value_int(ncFile, filename, ncVarID, 'missing_value', spvalINT)

case (NF90_FLOAT)
call get_FillValue(domid, varid, spvalR4)
call check_attribute_value_r4(ncFile, filename, ncVarID, '_FillValue', spvalR4)
call get_missing_value(domid, varid, spvalR4)
call check_attribute_value_r4(ncFile, filename, ncVarID, 'missing_value', spvalR4)

case (NF90_DOUBLE)
call get_FillValue(domid, varid, spvalR8)
call check_attribute_value_r8(ncFile, filename, ncVarID, '_FillValue', spvalR8)
call get_missing_value(domid, varid, spvalR8)
call check_attribute_value_r8(ncFile, filename, ncVarID, 'missing_value', spvalR8)

case default
!>@todo FIXME report the variable with the unsupported xtype
call error_handler(E_ERR, 'check_attributes', 'unknown xtype', source)
end select
endif

if ( get_has_FillValue( domid, varid) ) then
select case (get_xtype(domid, varid))
case (NF90_INT)
call get_FillValue(domid, varid, spvalINT)
call check_attribute_value_int(ncFile, filename, ncVarID, '_FillValue', spvalINT)

case (NF90_FLOAT)
call get_FillValue(domid, varid, spvalR4)
call check_attribute_value_r4(ncFile, filename, ncVarID, '_FillValue', spvalR4)

case (NF90_DOUBLE)
call get_FillValue(domid, varid, spvalR8)
call check_attribute_value_r8(ncFile, filename, ncVarID, '_FillValue', spvalR8)

case default
!>@todo FIXME report the variable with the unsupported xtype
call error_handler(E_ERR, 'check_attributes', 'unknown xtype', source)
end select
endif
Expand Down

0 comments on commit c4de64f

Please sign in to comment.