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
168 stars 161 forks source link

Sampling GeosChem CO2 simulation at OBSPACK sites #2423

Open SumanClimate opened 2 months ago

SumanClimate commented 2 months ago

Your name

Suman Maity

Your affiliation

NIES

Please provide a clear and concise description of your question or discussion topic.

Dear all I am pretty new to the GeosChem community. I was conducting CO2 simulation using GeosCheM-13.2.1. My input.geos is as follows:

------------------------+------------------------------------------------------
%%% SIMULATION MENU %%% :
Start YYYYMMDD, hhmmss  : 20190701 000000
End   YYYYMMDD, hhmmss  : 20190710 000000
Run directory           : ./
Root data directory     : /home/suman/GC-learn/ExtData
Met field               : MERRA2
Simulation name         : CO2
Species database file   : ./species_database.yml
Turn on debug printout? : F
Use GC classic timers?  : F
------------------------+------------------------------------------------------
%%% GRID MENU %%%       :
Grid resolution         : 2.0x2.5
Longitude min/max       : -180.0 180.0
 Center on 180E/W?      : T
Latitude  min/max       :  -90.0  90.0
 Half-sized polar boxes?: T
Number of levels        : 72
Nested grid simulation? : F
 Buffer zone (N S E W ) :  0  0  0  0
------------------------+------------------------------------------------------
%%% TIMESTEP MENU %%%   :
Tran/conv timestep [sec]: 600
Chem/emis timestep [sec]: 1200
------------------------+------------------------------------------------------
%%% ADVECTED SPECIES MENU %%%:
Species name            : CO2
------------------------+------------------------------------------------------

Rest part is as usual. I didn't change the HEMCO_Config.rc and HEMCO_Diagn.rc. My HISTORY.rc is as follows: EXPID: ./OutputDir/GEOSChem

#==============================================================================
# %%%%% COLLECTION NAME DECLARATIONS %%%%%
#
# To enable a collection, remove the "#" character in front of its name. The
# Restart collection should always be turned on.
#
# NOTE: These are the "default" collections for GEOS-Chem, but you can create
# your own customized diagnostic collections as well.
#==============================================================================
COLLECTIONS: 'Restart',
             #'CO2,
             'SpeciesConc',
             #'Budget',
             #'CloudConvFlux',
             #'LevelEdgeDiags',
             #'StateMet',
             #'BoundaryConditions',
::
###############################################################################
### The rest of this file consists of collection definitions.               ###
### Above collections whose declarations are commented out will be ignored. ###
### Make sure that each collection definition, as well as the list of       ###
### collections above, ends with a double-colon ("::").                     ###
###############################################################################

#==============================================================================
# %%%%% THE Restart COLLECTION %%%%%
#
# GEOS-Chem restart file fields
#
# Available for all simulations
#==============================================================================
  Restart.filename:           './GEOSChem.Restart.%y4%m2%d2_%h2%n2z.nc4',
  Restart.frequency:          'End',
  Restart.duration:           'End',
  Restart.mode:               'instantaneous'
  Restart.fields:             'SpeciesRst_?ALL?               ',
                              'Met_DELPDRY                    ',
                              'Met_PS1WET                     ',
                              'Met_PS1DRY                     ',
                              'Met_SPHU1                      ',
                              'Met_TMPU1                      ',
::
#==============================================================================
# %%%%% THE SpeciesConc COLLECTION %%%%%
#
# GEOS-Chem species concentrations (default = advected species)
#
# Available for all simulations
#==============================================================================
  SpeciesConc.template:       '%y4%m2%d2_%h2%n2z.nc4',
  SpeciesConc.frequency:      00000001 000000
  SpeciesConc.duration:       00000100 000000
  SpeciesConc.mode:           'time-averaged'
  SpeciesConc.fields:         'SpeciesConc_?ALL?             ',
::
#==============================================================================

Rest part is same as default. I successfully completed the simulation and the checked the model output. Everything is okay. Now I need to sample the simulated concentration at the obspack observation. I did the following in the input.geos:

%%% OBSPACK MENU %%%    :
Turn on ObsPack diag?   : T
Quiet logfile output    : T
ObsPack input file      : ./home/suman/GC-learn/obspack_co2_1_GLOBALVIEWplus_v6.0_2020-09-11/co2_brw_surface-insitu_1_allvalid.nc
ObsPack output file     : ./OutputDir/GEOSChem.ObsPack.nc4
ObsPack output species  : CO2
------------------------+------------------------------------------------------

But, I didn't find any output after the simulation. Could you please help me where I am doing mistake? Also, if I want to sample at multiple sites, how I can do that? Your help is highly solicited.

yantosca commented 2 months ago

Thanks for writing. The 13.2.1 version you are using is no longer supported. There have been some fixes to the ObsPack diagnostic module since then.

One thing I would recommend is to change "Quiet logfile output" from T to F. That will print out a lot of extra debug information to the log file. You can then see if the code is finding any observations. It could be that the file doesn't have observations for the time period that you are using.

SumanClimate commented 2 months ago

Hi Bob Thank you very much for your quick reply. I understand that there is no support for GCClassic-13.2.1 as it is a bit old version. However, as you suggested, I did simulation with "Quiet logfile output" from T to F in version GCClassic-13.2.1 ------------------------+------------------------------------------------------ %%% OBSPACK MENU %%% : Turn on ObsPack diag? : T Quiet logfile output : F ObsPack input file : ./home/suman/GC-learn/obspack_co2_1_GLOBALVIEWplus_v6.0_2020-09-11/co2_oxk_surface-flask_1_representative.nc ObsPack output file : ./OutputDir/GEOSChem.ObsPack.nc4 ObsPack output species : CO2 ------------------------+------------------------------------------------------ Unfortunately, it didn't create any debug information in the log file. Please see here GC13.2.1.log

In addition, I repeated the same experiment on more recent version, GCClassic-14.4.0, but no solution. Please find here GC14.4.0.log

Moreover, I want to sample GeosChem model output for multiple ObsPack sites. How I can do that? Kindly comment. Your help is highly solicited.

SumanClimate commented 2 months ago

I am sorry Bob, I made mistake at the ObsPack input file directory. I corrected and made simulation using version 13.2.1. Now I am able to produce the ObsPack output file. Kindly reply my third queries which is about sampling at multiple obspack sites.

yantosca commented 2 months ago

Thanks for the reply @SumanClimate. To sample at multiple sites you could probably combine several ObsPack files into a single input file (using either Python or the netCDF utilities).

Also note @jhaskinsPhD and @eastjames have created packages that lets you customize an ObsPack input file. You could try customizing one of these to specify multiple sites in the same file. See:

SumanClimate commented 2 months ago

Thank you Bob for your kind help. I will definitely check that later. However, I am facing couple of other issues and need your kind help. They are described below:

  1. For your information, I am using GEOS-Chem version 14.4.0. I hope this is okay for testing. If not, let me know which version, I will use.
  2. As I mentioned earlier, now I can generate the netcdf file having sampled geos-chem data corresponding to an obspack file. However, the values are all zero. For example I consider a case where geos-chem is running during 1 July, 2019 to 3 July, 2019 and sampling the data for the BRW obspack site (co2_brw_surface-flask_1_representative.nc; I took this data from obspack_co2_1_GLOBALVIEWplus_v6.0_2020-09-11.nc.tar.gz). I manually check this data file has two data during simulation period:

OBSPACK SAMPLING at 2019/07/02 20:10:00 Obs # ID string


4878 obspack_co2_1_GLOBALVIEWplus_v6.0_2020-09-11~co2_brw_surface-flask_1_representative~18584 4879 obspack_co2_1_GLOBALVIEWplus_v6.0_2020-09-11~co2_brw_surface-flask_1_representative~18585 These two data are valid on July 2, 2019 at 19:41 and 19:57

But still the output contain all zero. I have few points: i) Whether to consider time of the data in obspack at "start" or "middle" is decided based on the comment of the "time" variable in the netcdf file (line no. 480, obspack_mod.f90). But the text is used for searching ("midpoint of the averaging interval") in the fortran file is wrong. I checked that the comment used for "time" in the netcdf is following: "POSIX time. Number of seconds since January 1, 1970 in UTC. Time-averaged values are reported at the middle of the averaging interval." So, "midpoint of the averaging interval" will never happen and therefore Window_Start_Time will remain True which means although the obspack data demands to use the time at the middle of the interval, fortran code will consider it from the start of the interval. Please comment. ii) Even after changing that to middle of the interval, sampled data are all zero. I don't know where I am making mistake. I checked in GEOS-Chem/Interfaces/GCClassic/main.F90 that while inside of the dynamic timestamp do loop, "State_Diag" values are correct. However, after coming out of the dynamic timestamp loop and preparing for writing, "State_Diag" are all zero which indicate the out of the obspack diagnostic have all zero values. Kindly comment. I attach a zip file having all the necessary information and dataset to regenerate the simulation. Kindly check and comment. Geos-Chem14.4.0.zip Thank you.

yantosca commented 1 month ago

Thanks for your patience @SumanClimate. Maybe we need to implement a fix to check for both "midpoint of the averaging interval" and "middle of the averaging interval" labels. With ObsPack there doesn't seem to be a data standard (according to @jhaskinsPhD) so it could be possible that some files use one label and other files use the other label.