geoschem / geos-chem

GEOS-Chem "Science Codebase" repository. Contains GEOS-Chem science routines, run directory generation scripts, and interface code. This repository is used as a submodule within the GCClassic and GCHP wrappers, as well as in other modeling contexts (external ESMs).
http://geos-chem.org
Other
167 stars 163 forks source link

[BUG/ISSUE] ObsPack ERROR #1542

Closed JinZheeee closed 1 year ago

JinZheeee commented 1 year ago

Hi, The model version I used is 14.0.1, and I'm trying to run the CO2 simulation with ObsPack diagnostic. The CO2 simulation can run successfully if I turn off ObsPack diagnostic. But the ObsPack diagnostic cannot run successfully, the error report is:

GEOS-Chem ERROR: OBSPACK: No valid species found!  Exiting...
 -> at ObsPack_SpeciesMap_Init (in module Obspack/obspack_mod.F90)
===============================================================================

===============================================================================
GEOS-CHEM ERROR: Error encountered in "ObsPack_SpeciesMap_Init"!
STOP at  -> at GEOS-Chem (in GeosCore/main.F90)
===============================================================================
 Timer forced to stop due to error: GEOS-Chem                     
 Timer forced to stop due to error: Initialization 

This is my geoschem_config.yml:

---
### geoschem_config.yml: GEOS-Chem Runtime configuration options.
### Customized for simulations using the CO2 mechanism.
###
### NOTE: Add quotes around nitrogen oxide ('NO'), because YAML
### parsers will confuse this with a negative "no" value.

#============================================================================
# Simulation settings
#============================================================================
simulation:
  name: CO2
  start_date: [20140906, 000000]
  end_date: [20140907, 000000]
  root_data_dir: /fs1/home/jinz/data/GEOS-Chem-data
  met_field: MERRA2
  species_database_file: ./species_database.yml
  debug_printout: false
  use_gcclassic_timers: true

#============================================================================
# Grid settings
#============================================================================
grid:
  resolution: 2.0x2.5
  number_of_levels: 72
  longitude:
    range: [-180.0, 180.0]
    center_at_180: true 
  latitude:
    range: [-90.0, 90.0]
    half_size_polar_boxes: true 
  nested_grid_simulation:
    activate: false
    buffer_zone_NSEW: [0, 0, 0, 0]

#============================================================================
# Timesteps settings
#============================================================================
timesteps:
  transport_timestep_in_s: 600
  chemistry_timestep_in_s: 1200

#============================================================================
# Settings for GEOS-Chem operations
#============================================================================
operations:

  chemistry:
    activate: true

  convection:
    activate: true

  pbl_mixing:
     activate: true
     use_non_local_pbl: true 

  transport:
    gcclassic_tpcore:                 # GEOS-Chem Classic only
      activate: true                  # GEOS-Chem Classic only
      fill_negative_values: true      # GEOS-Chem Classic only
      iord_jord_kord: [3, 3, 7]       # GEOS-Chem Classic only
    transported_species:
      - CO2

#============================================================================
# Settings specific to the CO2 simulation
#============================================================================
CO2_simulation_options:

  sources:
    fossil_fuel_emissions: true
    ocean_exchange: true
    balanced_biosphere_exchange: true
    net_terrestrial_exchange: false
    ship_emissions: false
    aviation_emissions: false
    3D_chemical_oxidation_source: false

  tagged_species:
    save_fossil_fuel_in_background: false
    tag_bio_and_ocean_CO2: false
    tag_land_fossil_fuel_CO2: 
    tag_global_ship_CO2: false
    tag_global_aircraft_CO2: false

#============================================================================
# Settings for diagnostics (other than HISTORY and HEMCO)
#============================================================================
extra_diagnostics:

  obspack:
    activate: true
    quiet_logfile_output: false
    input_file: /fs1/home/jinz/data/ObsPack/obspack_co2_1_GLOBALVIEWplus_v7.0_2021-08-18/daily_nc_file/obspack_co2_1_GLOBALVIEWplus_v7.0_2021-08-18.YYYYMMDD.nc
    output_file: ./OutputDir/GEOSChem.ObsPack.YYYYMMDD_hhmmz.nc4
    output_species: 
      - CO2

  planeflight:
    activate: false
    flight_track_file: Planeflight.dat.YYYYMMDD
    output_file: plane.log.YYYYMMDD

  legacy_bpch:                #          1         2         3
     output_menu:             # 1234567890123456789012345678901
       schedule_output_for_JAN: 3000000000000000000000000000000
       schedule_output_for_FEB: 30000000000000000000000000000
       schedule_output_for_MAR: 3000000000000000000000000000000
       schedule_output_for_APR: 300000000000000000000000000000
       schedule_output_for_MAY: 3000000000000000000000000000000
       schedule_output_for_JUN: 300000000000000000000000000000
       schedule_output_for_JUL: 3000000000000000000000000000000
       schedule_output_for_AUG: 3000000000000000000000000000000
       schedule_output_for_SEP: 300000000000000000000000000000
       schedule_output_for_OCT: 3000000000000000000000000000000
       schedule_output_for_NOV: 300000000000000000000000000000
       schedule_output_for_DEC: 3000000000000000000000000000000

    gamap:
      diaginfo_dat_file: ./diaginfo.dat
      tracerinfo_dat_file: ./tracerinfo.dat

    bpch_diagnostics:
      TOMAS_aerosol_emissions: "0 all"
      TOMAS_rate: "0 all"
      TOMAS_3D_rate: "0 all"

    ND51_satellite:
      activate: false
      output_file: ts_satellite.YYYYMMDD.bpch
      tracers:
        - 1
        - 2
        - 501
      UTC_hour_for_write: 0
      averaging_period_in_LT: [9, 11]
      IMIN_and_IMAX_of_region: [1, 72]
      JMIN_and_JMAX_of_region: [1, 46]
      LMIN_and_LMAX_of_region: [1, 1]

    ND51b_satellite:
      activate: false
      output_file: ts_13_15_NA..YYYYMMDD.bpch
      tracers:
        - 1
        - 2
        - 501
      UTC_hour_for_write: 1
      averaging_period_in_LT: [13, 15]
      IMIN_and_IMAX_of_region: [1, 72]
      JMIN_and_JMAX_of_region: [1, 46]
      LMIN_and_LMAX_of_region: [1, 1]

Look forward to hearing from you.

Thanks.

yantosca commented 1 year ago

Thanks @JinZheeee for reporting this. Could you tell us the path where you downloaded the ObsPack data file is? We can try to replicate that error. I wonder if the name of the species in the file does not match the name of the GEOS-Chem species or something like that.

sabourbaray commented 1 year ago

Hello,

I think this issue is from a bug in input_mod:

    !------------------------------------------------------------------------
    ! Species names
    !------------------------------------------------------------------------
    key   = "extra_diagnostics%obspack%output_species"
    a_str = MISSING_STR
    CALL QFYAML_Add_Get( Config, TRIM( key ), v_str, "", RC )
    IF ( RC /= GC_SUCCESS ) THEN
       errMsg = 'Error parsing ' // TRIM( key ) // '!'
       CALL GC_Error( errMsg, RC, thisLoc )
       RETURN
    ENDIF

Should be as follows:

    !------------------------------------------------------------------------
    ! Species names
    !------------------------------------------------------------------------
    key   = "extra_diagnostics%obspack%output_species"
    a_str = MISSING_STR
    CALL QFYAML_Add_Get( Config, TRIM( key ), a_str, "", RC, dynamic_size=.TRUE. )
    IF ( RC /= GC_SUCCESS ) THEN
       errMsg = 'Error parsing ' // TRIM( key ) // '!'
       CALL GC_Error( errMsg, RC, thisLoc )
       RETURN
    ENDIF

Obspack worked for me after I applied this change.

JinZheeee commented 1 year ago

Thanks @yantosca for your reply. I downloaded the obspack data from https://gml.noaa.gov/ccgg/obspack/data.php. The current data version provided is v8.0 (obspack_co2_1_GLOBALVIEWplus_v8.0_2022-08-27), and the version I used is v7.0 (obspack_co2_1_GLOBALVIEWplus_v7.0_2021-08-18).

yantosca commented 1 year ago

Thanks @sabourbaray and @JinZheeee. I'll look into this error in input_mod.F90.

yantosca commented 1 year ago

@sabourbaray: I confirmed that your fix worked. I'll push a bug fix branch.

yantosca commented 1 year ago

I've opened a PR #1554 for this issue. It will go into 14.1.0 pending successful integration tests.

yantosca commented 1 year ago

We are now aiming to get this into 14.2.0. In the meantime, users can apply the simple fix shown above.

yantosca commented 1 year ago

This fix has been merged into 14.1.0. We can now close this issue.