geoschem / HEMCO

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

Using custom non-global grids #243

Closed tanksnr closed 6 months ago

tanksnr commented 11 months ago

Name: Mogesh Naidoo Institution: Council for Scientific and Industrial Research (CSIR South Africa)

Confirm you have reviewed the following documentation

Description of your issue or question

I'd like to know if there are any guides on running HEMCO standalone on a custom non-global grid. I specifically want to eventually run the soil NOx extension but using my own input (meteorology, land cover, soil data etc). The end goal is to compare the MEGAN (YL95) scheme with HEMCO (updated Hudman scheme) for my domain using consistent input data.

I've created a run directory specifying "custom" resolution and built HEMCO 3.7.1. I've tried running HEMCO using my own grid file, but get stuck at the grid "RES" specification. From what I can see in hco_config_mod.F90, I can only use specific resolutions? If I don't specify the "RES" in the config file, it goes a bit further but I get this error:


HEMCO ERROR: Improperly formatted grid resolution: unknown_res
 --> LOCATION: ReadSettings (hco_config_mod.F90)

HEMCO ERROR: Error in HEMCO_Config.rc @ section ### BEGIN SECTION SETTINGS
 --> LOCATION: Config_ReadFile (hco_config_mod.F90)

HEMCO ERROR: Error reading HEMCO_Config.rc @ line: HEMCO_Config.rc
 --> LOCATION: Config_ReadCont (hco_config_mod.F90)

HEMCO ERROR: Error in HEMCO_Config.rc @ section: ### BEGIN SECTION BASE EMISSIONS
 --> LOCATION: Config_ReadFile (hco_config_mod.F90)

HEMCO ERROR: Error encountered in routine "Config_Readfile!"
 --> LOCATION: HCOI_SA_Init (in module HEMCO/Interfaces/hcoi_standalone_mod.F90)

HEMCO ERROR: Error encountered in routine "HCO_Sa_Init"!
 --> LOCATION:  -> at HCOI_StandAlone_Run (in module HEMCO/Interfaces/hcoi_standalone_mod.F90)
HEMCO_STANDALONE EXITED WITH ERROR!

Is it possible to run HEMCO (standalone) with custom grids?

I'm attaching my HEMCO_sa_Config.rc and grid.rc files.

HEMCO_sa_Config.txt HEMCO_sa_Grid-0.06x0.06_RSA.txt

yantosca commented 11 months ago

Thanks for writing @tanksnr. At present I believe HEMCO standalone assumes a lat-lon grid, as most emissions come to us in that format. We have never tried to use a non-regular grid with HEMCO.

Also tagging @jimmielin who may have more thoughts.

yantosca commented 11 months ago

Also see #149

tanksnr commented 11 months ago

Hi Bob,

Thanks for assisting. My grid is regular lat-lon, at a resolution of 0.06deg. The extent covers South Africa. From the user guides etc it does seem possible, or at the very least it doesn't state that this is impossible. However the code I've seen so far indicates you can only choose certain resolutions and grids. Of course I may be mistaken and this selection is purely for meta data?

regards, mogesh.

yantosca commented 11 months ago

Hi @tanksnr. If it is a regular grid then you should be able to read it with HEMCO. The files that are provided are just samples but you can modify them for your specific grid.

If your grid is regular, you should just be able to define it by setting these variables to the specifics of your grid. The example below is for 0.5 x 0.625.

XMIN: -180.3125    # Westernmost longitude edge
XMAX:  179.6875    # Easternmost longitude edge
YMIN: -90.0        # Southernmost latitude edge
YMAX:  90.0        # Northernmost latititude edge
NX: 576            # Number of longitudes in grid
NY: 361            # Number of latitudes in grid
NZ: 47             # Number of levels in grid
tanksnr commented 11 months ago

I created my own grid.rc file as input (see first post for attachment), here's the first part:

XMIN: 14.991
XMAX: 35.091
YMIN: -37.445
YMAX: -21.305
NX: 335
NY: 269
NZ: 24

HEMCO hasn't gotten yet to evaluating it I think. The main issue I think is the "RES" specification in the config file. Support page says:

RES

If present, the $RES token will be set to the value specified.

If omitted, this value is determined based on compiler switches.

In hco_config_mod.F90 there's a case statement that checks the value of RES. There are some hard-coded values, corresponding to the sample grid.rc files resolution strings in the file names. If I omit the RES in the config file, it is assigned "unknown_res". If RES is "unknown_res" or anything other than the hard-coded values, I get the error. Admittedly, I haven't dug deeper into what "RES" value does further down the code. If it's important at all?

tanksnr commented 11 months ago

Just an update. I did dig a bit deeper into hco_config_mod.F90. From what I can see it seems that I need to provide HEMCO with a RES value in the Config file that corresponds to the allowable values in the code. I get an error if I present it with anything else. If I do not specify something, I get an error as the RES value is then "unknown".

The good news is that in the code after the check, the RES value is not used anywhere else, nor are there any other definitions within the checks. So in the config file, I do provide a string that is allowed, e.g. 4x5, and everything runs regardless of the grid.rc definitions I give. Global or regional, at any resolution. I've only tested with re-gridding CEDS though.

stale[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. If there are no updates within 7 days it will be closed. You can add the "never stale" tag to prevent the Stale bot from closing this issue.

stale[bot] commented 6 months ago

Closing due to inactivity