geoschem / HEMCO

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

[FEATURE REQUEST] Supporting curvilinear grids in MESSy/A2A regridding #149

Open jimmielin opened 2 years ago

jimmielin commented 2 years ago

Background

During IGC10 (Emissions and deposition working group?) there was discussion of support for regridding of lambert conformal grids for HEMCO. However, at present, HEMCO only supports regridding to/from rectilinear grids.

Feature request

It will be useful to support curvilinear grids such as Lambert in the HEMCO regridding for GEOS-Chem Classic, without introducing ESMF dependencies. This will also improve capabilities in WRF-GC and HEMCO within CESM (until we move to the CESM input/output system)

This implementation is technically possible because MAP_A2A and MESSY_NCREGRID should be able to do this, just that the feature was not implemented. For example, in HCO_REGRID_MOD's REGRID_MAPA2A, the following construct forces a rectilinear grid:

    ! get longitude / latitude sizes
    nLonEdge = SIZE(LonE,1)
    nLatEdge = SIZE(LatE,1)

    ! Write input grid edges to shadow variables so that map_a2a accepts them
    ! as argument.
    ! Also, for map_a2a, latitudes have to be sines...
    ALLOCATE(LonEdgeI(nlonEdge), LatEdgeI(nlatEdge), STAT=AS )
    IF ( AS /= 0 ) THEN
       CALL HCO_ERROR( 'alloc error LonEdgeI/LatEdgeI', RC, THISLOC=LOC )
       RETURN
    ENDIF
    LonEdgeI(:) = LonE
    LatEdgeI(:) = SIN( LatE * HcoState%Phys%PI_180 )

    ! Get output grid edges from HEMCO state
    LonEdgeO(:) = HcoState%Grid%XEDGE%Val(:,1)
    LatEdgeO(:) = HcoState%Grid%YSIN%Val(1,:)

Similarly in HCOIO_MESSY_MOD's HCO_MESSY_REGRID:

    !-----------------------------------------------------------------
    ! Destination grid description.
    ! This creates a MESSy axis object for the target (=HEMCO) grid.
    !-----------------------------------------------------------------

    ! Get horizontal grid directly from HEMCO state
    lon   => HcoState%Grid%XEDGE%Val(:,1)
    lat   => HcoState%Grid%YEDGE%Val(1,:)

...

    ! ----------------------------------------------------------------
    ! Assign longitude: this is always the first dimension
    ! ----------------------------------------------------------------
    IF ( ASSOCIATED(lon) ) THEN
       N        = N + 1
       ax(N)%lm = .true.     ! LONGITUDE IS MODULO AXIS

       ! Axis dimension
       XLON = SIZE(lon,1)

       ! FOR NOW, ASSUME NO DEPENDENCIES. NEED TO EDIT HERE
       ! IF WE WANT TO USE CURVILINEAR GRIDS
       ax(N)%ndp    = 1          ! LONGITUDE IS ...
       ALLOCATE(ax(N)%dep(1), STAT=status)
       IF ( status/= 0 ) THEN
          CALL HCO_ERROR ( HcoState%Config%Err, 'Cannot allocate lon dependencies', RC )
          RETURN
       ENDIF
       ax(N)%dep(1) = N          ! ... INDEPENDENT
       ndep_lon     = N

It should be possible to instead use the full 2-D information for input latitudes/longitudes. However I lack expertise in the MESSy regridding code to implement this immediately, so I am posting this on the HEMCO GitHub as a feature request so we could potentially figure out a solution.

ktravis213 commented 2 years ago

Thanks for this request. I just want to add that as the EPA NEI emission (and other regional inventories) come in this format, this will be a very useful feature for streamlining future updates.