Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix improper handling of date timestamps and lat/lon bounds for mask files #311

Merged
merged 2 commits into from
Mar 12, 2025

Conversation

msulprizio
Copy link
Contributor

Name and Institution (Required)

Name: Melissa Sulprizio
Institution: Harvard

Describe the update

As reported in #307, mask with temporal variability were only read once per simulation. This was caused by a bug in hco_config_mod.F90 where the year and month values for mask fields were overwritten by the lat/lon bounds of the mask file and later set to -999. To fix this, new fields Lats and Lons have been added to the FileData type in hco_types_mod.F90. The lat and lon bounds are now directly stored in those 2D arrays without modifying the year and month values. The lat and lon values will now also be printed to the log file for mask files.

With this fix, the SEASONAL_RES_MASK container in the GEOS-Chem CH4 simulation now properly lists the year and month ranges instead of -999 values. Previously, the log file listed:

 New container set to ReadList:
Container SEASONAL_RES_MASK
    -->Data type       :            3
    -->Container ID    :            7
    -->Target ID       :            7
    -->File data home?           -999
    -->Source file     : $ROOT/CH4/v2024-01/ResME/reservoir_mask.01x01.nc
    -->ncRead?            T
    -->Shared data file?  F
    -->Source parameter: Mask
    -->Year range      :         -999        -999
    -->Month range     :         -999        -999
    -->Day range       :            1           1
    -->Hour range      :            0           0
    -->SpaceDim        :            2
    -->Array dimension :            0           0
    -->Array sum       :    0.00000000
    -->Array min & max :    0.00000000       0.00000000
    -->Time dimension  :            0
    -->Delta t[h]      :            0
    -->Local time?        F
    -->OrigUnit        : 1
    -->Concentration?     F
    -->Coverage        :            1
    -->Scal ID         :         1500
    -->Operator        :            1

With this fix:

 New container set to ReadList:
Container SEASONAL_RES_MASK
    -->Data type       :            3
    -->Container ID    :            6
    -->Target ID       :            6
    -->File data home?           -999
    -->Source file     : $ROOT/CH4/v2024-01/ResME/reservoir_mask.01x01.nc
    -->ncRead?            T
    -->Shared data file?  F
    -->Source parameter: Mask
    -->Year range      :         2022        2022
    -->Month range     :            1          12
    -->Day range       :            1           1
    -->Hour range      :            0           0
    -->SpaceDim        :            2
    -->Array dimension :            0           0
    -->Array sum       :    0.00000000
    -->Array min & max :    0.00000000       0.00000000
    -->Time dimension  :            0
    -->Delta t[h]      :            0
    -->Local time?        F
    -->OrigUnit        : 1
    -->Concentration?     F
    -->Coverage        :            1
    -->Lon range       :         -180         180
    -->Lat range       :          -90          90
    -->Scal ID         :         1500
    -->Operator        :            1

I have confirmed that the reservoir mask file in these simulations is now read and updated monthly. From the log file:

 Processing container: SEASONAL_RES_MASK
 Parsing source file and replacing tokens
 Opening file: /n/holylfs06/LABS/jacob_lab/Shared/GEOS-CHEM/gcgrid/gcdata/ExtData/HEMCO/CH4/v2024-01/ResME/reservoir_mask.01x01.nc
HEMCO: Opening /n/holylfs06/LABS/jacob_lab/Shared/GEOS-CHEM/gcgrid/gcdata/ExtData/HEMCO/CH4/v2024-01/ResME/reservoir_mask.01x01.nc
HEMCO: Entering GET_TIMEIDX (HCOIO_UTIL_MOD.F90) ( 6)
 Number of time slices found:           12
 Time slice range :    202201010000.00000        202212010000.00000
          preferred datetime:  202201010000.
              selected tidx1:              1
...
 Processing container: SEASONAL_RES_MASK
 Parsing source file and replacing tokens
 Opening file: /n/holylfs06/LABS/jacob_lab/Shared/GEOS-CHEM/gcgrid/gcdata/ExtData/HEMCO/CH4/v2024-01/ResME/reservoir_mask.01x01.nc
HEMCO: Opening /n/holylfs06/LABS/jacob_lab/Shared/GEOS-CHEM/gcgrid/gcdata/ExtData/HEMCO/CH4/v2024-01/ResME/reservoir_mask.01x01.nc
HEMCO: Entering GET_TIMEIDX (HCOIO_UTIL_MOD.F90) ( 6)
 Number of time slices found:           12
 Time slice range :    202201010000.00000        202212010000.00000
          preferred datetime:  202202010000.
              selected tidx1:              2
...
 Processing container: SEASONAL_RES_MASK
 Parsing source file and replacing tokens
 Opening file: /n/holylfs06/LABS/jacob_lab/Shared/GEOS-CHEM/gcgrid/gcdata/ExtData/HEMCO/CH4/v2024-01/ResME/reservoir_mask.01x01.nc
HEMCO: Opening /n/holylfs06/LABS/jacob_lab/Shared/GEOS-CHEM/gcgrid/gcdata/ExtData/HEMCO/CH4/v2024-01/ResME/reservoir_mask.01x01.nc
HEMCO: Entering GET_TIMEIDX (HCOIO_UTIL_MOD.F90) ( 6)
 Number of time slices found:           12
 Time slice range :    202201010000.00000        202212010000.00000
          preferred datetime:  202203010000.
              selected tidx1:              3
etc.

Expected changes

This is a zero-difference update with respect to full-chemistry benchmark simulations. It will impact CH4 GEOS-Chem simulations which do include mask files with temporal variability.

Related Github Issue

…files

As reported in #307, mask with temporal
variability were only read once per simulation. This was caused by a bug in
`hco_config_mod.F90` where the year and month values for mask fields were
overwritten by the lat/lon bounds of the mask file and later set to -999.
To fix this, new fields `Lats` and `Lons` have been added to the `FileData`
type in hco_types_mod.F90. The lat and lon bounds are now directly stored
in those 2D arrays without modifying the year and month values. The lat and
lon values will now also be printed to the log file for mask files.

Signed-off-by: Melissa Sulprizio <mpayer@seas.harvard.edu>
@msulprizio msulprizio added the category: Bug Fix Fixes a bug that was previously reported label Mar 6, 2025
@msulprizio msulprizio requested a review from yantosca March 6, 2025 17:43
@msulprizio msulprizio self-assigned this Mar 6, 2025
msulprizio added a commit to geoschem/geos-chem that referenced this pull request Mar 6, 2025
…y seasonality

CH4 reservoir emissions previously used the timestamp `2022/1/1/0` and were
therefore only computed once per simulation. To properly apply seasonality to
these emissions, we need to change the timestamp to `2022/1-12/1/0` which
will tell HEMCO to compute the fields monthly and apply the mask file for that
month.

This fix is needed along with geoschem/HEMCO#311 to
address geoschem/HEMCO#307.

Signed-off-by: Melissa Sulprizio <mpayer@seas.harvard.edu>

# Conflicts:
#	CHANGELOG.md
Signed-off-by: Melissa Sulprizio <mpayer@seas.harvard.edu>
@msulprizio msulprizio added this to the 3.11.0 milestone Mar 6, 2025
Copy link
Contributor

@yantosca yantosca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @msulprizio! Looks good to merge!

@yantosca yantosca merged commit c0ff9d9 into dev/3.11.0 Mar 12, 2025
15 checks passed
@yantosca yantosca linked an issue Mar 12, 2025 that may be closed by this pull request
@yantosca yantosca added the topic: Scaling or Masking Related to issues in applying scale factors or masks label Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Bug Fix Fixes a bug that was previously reported topic: Scaling or Masking Related to issues in applying scale factors or masks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResME reservoir mask only is read once instead of monthly
2 participants