geoschem / HEMCO

The Harmonized Emissions Component (HEMCO), developed by the GEOS-Chem Support Team.
https://hemco.readthedocs.io
Other
17 stars 32 forks source link

Error when reading OCEAN_MASK in TransportTracer simulation #204

Closed msulprizio closed 1 year ago

msulprizio commented 1 year ago

Name and Institution (Required)

Name: Melissa Sulprizio Institution: Harvard/GCST

Confirm you have reviewed the following documentation

Description of your issue or question

After merging in PR https://github.com/geoschem/HEMCO/pull/198, GCClassic integration tests are failing for the TransportTracer simulations. The simulation is crashing when attempting to read OCEAN_MASK, defined in HEMCO_Config.rc as:

1000 OCEAN_MASK  $METDIR/$CNYR/01/$MET.$CNYR0101.CN.$RES.$NC FROCEAN 2000/1/1/0 C xy 1 1 -180/-90/180/90

The error from HEMCO is:

 Read from config file: OCEAN_MASK
At line 139 of file /n/home05/msulprizio/RD/gc_4x5_merra2_TransportTracers/CodeDir/src/HEMCO/src/Core/hco_chartools_mod.F90
Fortran runtime error: Bad real number in item 1 of list input

Error termination. Backtrace:
#0  0x2b4c27e518e8 in read_real
        at ../.././libgfortran/io/list_read.c:2026
#1  0x2b4c27e52d14 in list_formatted_read_scalar
        at ../.././libgfortran/io/list_read.c:2180
#2  0xa46114 in __hco_chartools_mod_MOD_hco_charsplit_r8
        at /n/home05/msulprizio/RD/gc_4x5_merra2_TransportTracers/CodeDir/src/HEMCO/src/Core/hco_chartools_mod.F90:139
#3  0xa9e55c in __hcoio_util_mod_MOD_getdatavals
        at /n/home05/msulprizio/RD/gc_4x5_merra2_TransportTracers/CodeDir/src/HEMCO/src/Core/hcoio_util_mod.F90:2777
#4  0xaa061c in __hcoio_util_mod_MOD_hcoio_readfromconfig
        at /n/home05/msulprizio/RD/gc_4x5_merra2_TransportTracers/CodeDir/src/HEMCO/src/Core/hcoio_util_mod.F90:2489
#5  0xaa3214 in __hcoio_util_mod_MOD_hcoio_readother
        at /n/home05/msulprizio/RD/gc_4x5_merra2_TransportTracers/CodeDir/src/HEMCO/src/Core/hcoio_util_mod.F90:2188
#6  0xa8ccb1 in readlist_fill
        at /n/home05/msulprizio/RD/gc_4x5_merra2_TransportTracers/CodeDir/src/HEMCO/src/Core/hco_readlist_mod.F90:491
#7  0xa8e5f5 in __hco_readlist_mod_MOD_readlist_read
        at /n/home05/msulprizio/RD/gc_4x5_merra2_TransportTracers/CodeDir/src/HEMCO/src/Core/hco_readlist_mod.F90:288
#8  0xa6b886 in __hco_driver_mod_MOD_hco_run
        at /n/home05/msulprizio/RD/gc_4x5_merra2_TransportTracers/CodeDir/src/HEMCO/src/Core/hco_driver_mod.F90:165
#9  0x48ea58 in __hco_interface_gc_mod_MOD_hcoi_gc_run
        at /n/home05/msulprizio/RD/gc_4x5_merra2_TransportTracers/CodeDir/src/GEOS-Chem/GeosCore/hco_interface_gc_mod.F90:999
#10  0x452a3f in __emissions_mod_MOD_emissions_run
        at /n/home05/msulprizio/RD/gc_4x5_merra2_TransportTracers/CodeDir/src/GEOS-Chem/GeosCore/emissions_mod.F90:204
#11  0x40515f in geos_chem
        at /n/home05/msulprizio/RD/gc_4x5_merra2_TransportTracers/CodeDir/src/GEOS-Chem/Interfaces/GCClassic/main.F90:701
#12  0x403d96 in main
        at /n/home05/msulprizio/RD/gc_4x5_merra2_TransportTracers/CodeDir/src/GEOS-Chem/Interfaces/GCClassic/main.F90:32

Tagging @yantosca

yantosca commented 1 year ago

Hi @msulprizio! Thanks for bringing this up. I believe this is a syntax error. Try changing

... C xy 1 1 -180/-90/180/90

to

... C xy 1 1 - 180/-90/180/90

leave a space between the - and the mask limits. That should fix it.

msulprizio commented 1 year ago

@yantosca The syntax appears to be correct. The dash there is meant to be there so lat1=-180. Also, the correct number of entries are passed in that line, adding a space between the - and 180 causes HEMCO to crash when reading that line because of two many entries.

I suspect the issue is caused by these lines added in #198:

https://github.com/geoschem/HEMCO/blob/13abf5e5713e5d62012732c4b0ab3e21b62ee649/src/Core/hco_config_mod.F90#L2420-L2432

When I print Lct%Dct%Dta%ncFile there, it returns $METDIR/$CNYR/01/$MET.$CNYR0101.CN.$RES.$NC for OCEAN_MASK which I think means it is not recognized as a netCDF file.

yantosca commented 1 year ago

Thanks @msulprizio, I'll look into this now.

yantosca commented 1 year ago

This fixes the issue. I will prep a PR.

          ! If ncFile is passed as the lon1/lat1/lon2/lat2 instead
          ! of netCDF file name, then set ncRead to false, so that
          ! HEMCO won't try to read a file from disk.  Also set the
          ! IsLocTime flag to TRUE.  This should fix Github issue
          ! https://github.com/geoschem/HEMCO/issues/153.
          !  -- Bob Yantosca (12 Jul 2022)
          !
          ! Also allow for the .$NC replaceable token, see:
          ! https://github.com/geoschem/HEMCO/issues/204
          !  -- Melissa Sulprizio & Bob Yantosca (11 Apr 2023)
          IF ( INDEX( Lct%Dct%Dta%ncFile,   ".nc" ) == 0 ) THEN
             IF ( INDEX(  Lct%Dct%Dta%ncFile, ".$NC" ) == 0 ) THEN
                Lct%Dct%Dta%ncRead    = .FALSE.
                Lct%Dct%Dta%IsLocTime = .TRUE.
             ENDIF
          ENDIF
msulprizio commented 1 year ago

The fix for this issue (PR #205) is now merged into the 3.7.0 development branch.