Skip to content

Commit

Permalink
Merge pull request #12 from GEOS-ESM/feature/ewlundgr/hemco_3.8
Browse files Browse the repository at this point in the history
HEMCO 3.8
  • Loading branch information
Christoph Keller authored Feb 13, 2024
2 parents e5d4ce1 + 14a92fd commit ccbf008
Show file tree
Hide file tree
Showing 15 changed files with 838 additions and 107 deletions.
108 changes: 108 additions & 0 deletions .release/changeVersionNumbers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/bash

#EOC
#------------------------------------------------------------------------------
# Harmonized Emissions Component (HEMCO) !
#------------------------------------------------------------------------------
#BOP
#
# !MODULE: changeVersionNumbers.sh
#
# !DESCRIPTION: Bash script to change the version numbers in the appropriate
# files in the HEMCO directory structure. Run this before releasing
# a new HEMCO version.
#\\
#\\
# !CALLING SEQUENCE:
# $ ./changeVersionNumbers.sh X.Y.Z # X.Y.Z = HEMCO version number
#EOP
#------------------------------------------------------------------------------
#BOC

function replace() {

#========================================================================
# Function to replace text in a file via sed.
#
# 1st argument: Search pattern
# 2nd argument: Replacement text
# 3rd argument: File in which to search and replace
#========================================================================

sed -i -e "s/${1}/${2}/" "${3}"
}


function exitWithError() {

#========================================================================
# Display and error message and exit
#========================================================================

echo "Could not update version numbers in ${1}... Exiting!"
exit 1
}


function main() {

#========================================================================
# Replaces the version number in the files listed.
#
# 1st argument: New version number to use
#========================================================================

# New version number
version="${1}"

# Save this directory path and change to root directory
thisDir=$(pwd -P)
cd ..

#========================================================================
# Update version numbers in various files
#========================================================================

# Pattern to match: X.Y.Z
pattern='[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*'

# List of files to replace
files=( \
"CMakeLists.txt" \
"docs/source/conf.py" \
"src/Core/hco_error_mod.F90"
)

# Replace version numbers in files
for file in ${files[@]}; do
replace "${pattern}" "${version}" "${file}"
[[ $? -ne 0 ]] && exitWithError "${file}"
echo "HEMCO version updated to ${version} in ${file}"
done

#========================================================================
# Update version number and date in CHANGELOG.md
#========================================================================

# Pattern to match: "[Unreleased] - TBD"
pattern='\[.*Unreleased.*\].*'
date=$(date -Idate)
replace "${pattern}" "\[${version}\] - ${date}" "CHANGELOG.md"

# Return to the starting directory
cd "${thisDir}"
}

# ---------------------------------------------------------------------------

# Expect 1 argument, or exit with error
if [[ $# -ne 1 ]]; then
echo "Usage: ./changeVersionNumbers.sh VERSION"
exit 1
fi

# Replace version numbers
main "${1}"

# Return status
exit $?
38 changes: 26 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] - TBD
### Changed
- Updated TOMAS_Jeagle sea salt extension

### Fixed
- Updated IsModelLevel check for CESM and WRF-GC
- Interpolation error for 8-day MODIS LAI files (removed month loop in `GetIndex2Interp`)

## [3.7.2] - 2023-12-01
### Added
- Script `.release/changeVersionNumbers.sh` to change version numbers before a new HEMCO release

### Changed
- Increased netCDF variable string length from 50 to 100

### Fixed
- Rename `HEMCO_Config.rc.sample` to `HEMCO_Config.rc` in `createRunDir.sh` if sample is used.
- Added fix to turn off emissions extensions when `EMISSIONS` logical is false

## [3.7.1] - 2023-10-10
### Changed
- Updated version numbers to 3.7.1
Expand All @@ -30,7 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add GEOSIT as an allowable meteorology directory name in HEMCO_Config.rc
- Added `.readthedocs.yaml` file to configure ReadTheDocs builds

# Changed
### Changed
- `Verbose` is now a `true/false` variable in `run/HEMCO_sa_Config.rc` and `run/HEMCO_Config.rc.sample`
- HEMCO warnings are now only generated when `Verbose: true` is found in the HEMCO configuration file (no more numerical levels)
- Updated GFED4 emission factors for VOCs to Andreae et al. (2019)
Expand Down Expand Up @@ -100,14 +119,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [3.5.2] - 2022-11-29
### Added
- Added sanitizer option for detecting memory leaks in HEMCO
standalone during build
- Added sanitizer option for detecting memory leaks in HEMCO standalone during build

### Changed
- Remove unused, commented-out code in `src/Extensions/hcox_dustdead_mod.F`
- Replaced placeholder error messages in
`src/Core/hco_config_mod.F90` with more informational messages
(often including the line of the HEMCO_Config.rc in the printout)
- Replaced placeholder error messages in `src/Core/hco_config_mod.F90` with more informational messages (often including the line of the HEMCO_Config.rc in the printout)
- Added improved documentation for time cycle flag `EFYO` in ReadTheDocs

### Fixed
Expand All @@ -121,8 +137,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Support for MAPL 2.16 (needed by GCHP and GEOS)
- Bug fix for HEMCO standalone run directory creation
- Bug fix: If HEMCO masks are specified as `lon1/lat1/lon2/lat2`,
then don't try to read from disk
- Bug fix: If HEMCO masks are specified as `lon1/lat1/lon2/lat2`, then don't try to read from disk
- Documentation from the GEOS-Chem wiki (now on ReadTheDocs)
- Badges for the ReadTheDocs front page
- Bug fix for masking issues in MPI environment (for WRF, CESM)
Expand Down Expand Up @@ -265,6 +280,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bug fix for distributing emissions in the vertical dimension
- New error checks in the HEMCO standalone module
- Bug fix for `ifort` compiler in soil NOx extension

### Removed
- Null string character from netCDF unit string

Expand All @@ -280,8 +296,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [2.1.004] - 2017-12-30
### Added
- Updates to remove possible issues and excessive print statements when
operating in GEOS environment
- Updates to remove possible issues and excessive print statements when operating in GEOS environment
- Fixed possible tracer ID mismatch in sea salt extension
- New option to normalize MEGAN LAI, HEMCO diagnostics
- Now write multiple time slices into one file
Expand Down Expand Up @@ -364,8 +379,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.1.009] - 2015-09-10
### Added
- Bug fixes to allow specifying flexible diagnostics output
frequencies.
- Bug fixes to allow specifying flexible diagnostics output frequencies.

## [1.1.008] - 2015-07-06
### Added
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# HEMCO/CMakeLists.txt

cmake_minimum_required(VERSION 3.5)
project(HEMCO VERSION 3.7.1 LANGUAGES Fortran)
project(HEMCO VERSION 3.7.2 LANGUAGES Fortran)
# Reminder: Make sure to also update version in src/Core/hco_error_mod.F90

#-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ We use GitHub issues to support user questions. To ask a question, **[open a new

## What type of support can I expect?

We will be happy to assist you in resolving bugs and technical issues that arise when compiling or running HEMCO. User support and outreach is an important part of our mission to support the [International GEOS-Chem User Community](https://geoschem.github.io/geos-chem-people-projects-map/).
We will be happy to assist you in resolving bugs and technical issues that arise when compiling or running HEMCO. User support and outreach is an important part of our mission to support the [International GEOS-Chem User Community](https://geoschem.github.io/people.html).

Even though we can assist in several ways, we cannot possibly do everything. We rely on HEMCO users being resourceful and willing to try to resolve problems on their own to the greatest extent possible.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
author = 'GEOS-Chem Support Team'

# The full version, including alpha/beta/rc tags
release = '3.7.1'
release = '3.7.2'

# -- General configuration ---------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/source/hco-ref-guide/hemco-config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ year, month, day, or hour, and to scale emissions to a given value:
If omitted, the emisison month will be set to the model simulation
hour.

.. option:: EmissScale_<species-name>
.. option:: EmisScale_<species-name>

Optional argument to define a uniform scale factor that will be
applied across all inventories, categories, hierarchies, and
Expand Down
5 changes: 5 additions & 0 deletions run/createRunDir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ while [ "$valid_path" -eq 0 ]; do
if [[ "$hco_config_file" == *".rc"* ]]; then
hco_config_dir=$(dirname $hco_config_file)
fi

if [[ "$hco_config_file" == "./HEMCO_Config.rc.sample" ]]; then
mv "./HEMCO_Config.rc.sample" "./HEMCO_Config.rc"
hco_config_file="./HEMCO_Config.rc"
fi

done

Expand Down
30 changes: 26 additions & 4 deletions src/Core/hco_config_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ SUBROUTINE Config_ReadCont( HcoConfig, IU_HCO, CFDIR, &
LOGICAL :: Found
CHARACTER(LEN= 63) :: cName
CHARACTER(LEN=255) :: srcFile
CHARACTER(LEN= 50) :: srcVar
CHARACTER(LEN=100) :: srcVar
CHARACTER(LEN= 31) :: srcTime
CHARACTER(LEN= 31) :: TmCycle
CHARACTER(LEN= 1) :: WildCard
Expand Down Expand Up @@ -1816,9 +1816,9 @@ SUBROUTINE ExtSwitch2Buffer( HcoConfig, IU_HCO, EOF, RC )
!
! !USES:
!
USE HCO_CHARPAK_Mod, ONLY : STRREPL, STRSPLIT, TRANLC
USE HCO_EXTLIST_MOD, ONLY : AddExt, AddExtOpt, HCO_GetOpt
USE HCO_EXTLIST_MOD, ONLY : GetExtNr
USE HCO_CHARPAK_Mod, ONLY : STRREPL, STRSPLIT, TRANLC
USE HCO_EXTLIST_MOD, ONLY : AddExt, AddExtOpt, HCO_GetOpt
USE HCO_EXTLIST_MOD, ONLY : GetExtNr, GetExtOpt
!
! !INPUT PARAMETERS:
!
Expand All @@ -1841,6 +1841,7 @@ SUBROUTINE ExtSwitch2Buffer( HcoConfig, IU_HCO, EOF, RC )
!
INTEGER :: I, N, Idx, ExtNr
LOGICAL :: Enabled, NewExt
LOGICAL :: DoEmis, Found, LTMP
CHARACTER(LEN=255) :: loc
CHARACTER(LEN=512) :: msg
CHARACTER(LEN=1023) :: OPTS
Expand All @@ -1857,6 +1858,10 @@ SUBROUTINE ExtSwitch2Buffer( HcoConfig, IU_HCO, EOF, RC )
loc = 'ExtSwitch2Buffer (hco_config_mod.F90)'
ExtNr = -1

! Initialize
DoEmis= .TRUE.
Found = .FALSE.

! Do until exit
DO

Expand Down Expand Up @@ -1890,6 +1895,18 @@ SUBROUTINE ExtSwitch2Buffer( HcoConfig, IU_HCO, EOF, RC )
RETURN
ENDIF
ENDIF

! Check if EMISSIONS setting is found. If so, overwrite DoEmis.
IF ( .not. Found ) THEN
CALL GetExtOpt( HcoConfig, -999, 'EMISSIONS', &
OptValBool=LTMP, FOUND=Found, RC=RC )
IF ( RC /= HCO_SUCCESS ) THEN
msg = 'Error encountered in "GetExtOpt( EMISSIONS )"!'
CALL HCO_Error( msg, RC, ThisLoc=loc )
RETURN
ENDIF
IF ( Found ) DoEmis = LTMP
ENDIF
CYCLE
ENDIF

Expand Down Expand Up @@ -1942,6 +1959,11 @@ SUBROUTINE ExtSwitch2Buffer( HcoConfig, IU_HCO, EOF, RC )
Enabled = .FALSE.
ENDIF

! Disable extension if EMISSIONS logical is false
IF ( .not. DoEmis ) THEN
Enabled = .FALSE.
ENDIF

! Register extension name, number and species
! idx is the position of the species names
idx = idx+1
Expand Down
2 changes: 1 addition & 1 deletion src/Core/hco_error_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ MODULE HCO_Error_Mod
#endif

! HEMCO version number.
CHARACTER(LEN=12), PARAMETER, PUBLIC :: HCO_VERSION = '3.7.1'
CHARACTER(LEN=12), PARAMETER, PUBLIC :: HCO_VERSION = '3.7.2'

INTERFACE HCO_Error
MODULE PROCEDURE HCO_ErrorNoErr
Expand Down
2 changes: 1 addition & 1 deletion src/Core/hco_extlist_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ SUBROUTINE HCO_SetDefaultToken( CF, RC )
ELSE IF ( TRIM(CF%MetField) == 'GEOSIT' ) THEN
DEF_MET_UC = 'GEOSIT'
DEF_MET_LC = 'geosit'
DEF_CN_YR = '2018' ! Constant met fld year
DEF_CN_YR = '1998' ! Constant met fld year
DEF_NC_VER = 'nc' ! NetCDF extension
ENDIF

Expand Down
2 changes: 1 addition & 1 deletion src/Core/hco_types_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ MODULE HCO_TYPES_MOD
!-------------------------------------------------------------------------
TYPE :: FileData
CHARACTER(LEN=255) :: ncFile ! file path+name
CHARACTER(LEN= 50) :: ncPara ! file parameter
CHARACTER(LEN=100) :: ncPara ! file parameter
INTEGER :: ncYrs(2) ! year range
INTEGER :: ncMts(2) ! month range
INTEGER :: ncDys(2) ! day range
Expand Down
27 changes: 27 additions & 0 deletions src/Core/hcoio_read_std_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -695,12 +695,39 @@ SUBROUTINE HCOIO_Read( HcoState, Lct, RC )
! going to 72 levels. Otherwise, use MESSy (nbalasus, 8/24/2023).
IF ( Lct%Dct%Dta%Levels == 0 ) THEN

#if defined( MODEL_CESM ) || defined( MODEL_WRF )

! In WRF/CESM, IsModelLevel has a different meaning of "GEOS-Chem levels"
! because the models in WRF and CESM are user-defined and thus fixed input
! files would never be on the model level. In this case, a check is added
! in order to match the file with known GEOS-Chem levels, and if so, the
! data will be handled later in this file accordingly to be vertically
! regridded to the runtime model levels using MESSy.
! This fixes a regression from the vertical regridding fixes in 3.7.1.
!
! The meaning of "is model levels" in WRF and CESM are different.
! Model levels can be changed and thus data is never on the model level.
! In this case, IsModelLevel means that the data is on standard
! GEOS-Chem levels, and if so, the data will be handled accordingly
! using a hard-coded set of GEOS-Chem levels to be interpolated using MESSy.
! (hplin, 10/15/23)
IF ( TRIM(LevUnit) == "level" .or. TRIM(LevUnit) == "GEOS-Chem level" ) THEN
! the below check will be obsolete and is unmaintainable, but would be consistent with ModelLev_Check.
! it is more robust to check for the explicit intention of LevUnit
! nlev == 47 .or. nlev == 48 .or. nlev == 36 .or. nlev == 72 .or. nlev == 73 ) THEN
IsModelLevel = .true.
ENDIF

#else

CALL ModelLev_Check( HcoState, nlev, IsModelLevel, RC )
IF ( RC /= HCO_SUCCESS ) THEN
CALL HCO_ERROR( 'ERROR 3', RC, THISLOC=LOC )
RETURN
ENDIF

#endif

! Set level indeces to be read
lev1 = 1
lev2 = nlev
Expand Down
Loading

0 comments on commit ccbf008

Please sign in to comment.