Skip to content

Commit

Permalink
Merge branch 'feature/aoloso/splitfield' into refactor/aoloso/replace…
Browse files Browse the repository at this point in the history
…__RCplus_VERIFY_with__RC
  • Loading branch information
mathomp4 authored Dec 20, 2023
2 parents cd98d70 + ffed49a commit edbe07d
Show file tree
Hide file tree
Showing 40 changed files with 3,731 additions and 145 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bcs_version: &bcs_version v11.3.0
tag_build_arg_name: &tag_build_arg_name maplversion

orbs:
ci: geos-esm/circleci-tools@1
ci: geos-esm/circleci-tools@2

workflows:
build-and-test:
Expand Down Expand Up @@ -221,7 +221,7 @@ workflows:
when:
equal: [ "release", << pipeline.parameters.GHA_Event >> ]
jobs:
- ci/publish-docker:
- ci/publish_docker:
filters:
tags:
only: /^v.*$/
Expand All @@ -238,7 +238,7 @@ workflows:
compiler_version: 2022.1.0
image_name: geos-env
tag_build_arg_name: *tag_build_arg_name
- ci/publish-docker:
- ci/publish_docker:
filters:
tags:
only: /^v.*$/
Expand Down
4 changes: 4 additions & 0 deletions .github/actions/deploy-ford-docs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ runs:
run: ford --version
shell: bash

- name: cpp version
run: cpp --version
shell: bash

- name: Checkout gFTL
uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate_yaml_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
format: colored
config_file: .yamllint.yml

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: yamllint-logfile
Expand Down
32 changes: 31 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,48 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Made changes to allocate fields to use farray instead of farrayPtr. This allows explicit specification of indexflag required by the new MAPL field split functionality. This functionality allows a clean way to create a new field from an exiting field where the new field is a 'slice' of the existing field with the slicing index being that of the trailing ungiridded dim of the existing field.
- Replaced RC=STATUS plus `_VERIFY(RC)` in `Base_Base_implementation.F90` with just `_RC` in line with our new convention.
- Updated CI to use ESMF 8.6.0 (Baselibs 7.16.0) and updated ESMF required version to 8.6.0
- Swath grid step 1: allow for destroying and regenerating swath grid and regenerating regridder route handle, and creating
allocatable metadata in griddedIO. Modifications are made to GriddedIO.F90, MAPL_AbstractRegridder.F90, and MAPL_EsmfRegridder.F90.
- Swath grid step 2: add control keywords for swath grid. Allow for filename template with `'*'` and DOY. Allow for missing obs files. Specify index_name_lon/lat, var_name_lon/lat/time, tunit, obs_file_begin/end/interval, Epoch and Epoch_init.
- Update CI to Baselibs 7.17.0 (for future MAPL3 work) and the BCs v11.3.0 (to fix coupled run)
- Update `components.yaml`
- ESMA_env v4.22.0 (Baselibs 7.15.1)
- ESMA_env v4.24.0 (Baselibs 7.17.0)
- Update CI to use circleci-tools v2
- Made changes to allocate fields to use farray instead of farrayPtr. This allows explicit specification of indexflag required by the new MAPL field split functionality. This functionality allows a clean way to create a new field from an exiting field where the new field is a 'slice' of the existing field with the slicing index being that of the trailing ungiridded dim of the existing field.

### Fixed

- Fixed bug broken multi-step file output in History under certain template conditions
- [#2433] Implemented workarounds for gfortran-13
- Missing TARGET in GriddedIO - exposed runtime error when using NAG + debug.

### Removed

### Deprecated

## [2.42.4] - 2023-12-10

### Changed

- Improved error message for missing labels in GridManager.

### Fixed

- Corrected some unit tests (and test utilities) to fix dangling pointers detected by NAG. Most (possibly all) of these changes are already on release/MAPL-v3, but it was getting annoying to have NAG fail unit tests with develop branch.
- Fix for CMake an Apple. Needs to set `__DARWIN` as an fpp flag. (Only used by NAG, but ...)

## [2.42.3] - 2023-12-06

### Fixed

- `MAPL_Abort()` was passing an uninitialized integer to `MPI_Abort()` resulting in spurious false successes when running ctest. Maybe was happening frequently, but CI would be blind to this.

## [2.42.2] - 2023-12-05

### Fixed

- Corrected some unit tests (and test utilities) to fix dangling pointers detected by NAG. Most (possibly all) of these changes are already on release/MAPL-v3, but it was getting annoying to have NAG fail unit tests with develop branch.

## [2.42.1] - 2023-11-20

### Fixed
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif ()

project (
MAPL
VERSION 2.42.1
VERSION 2.42.4
LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF

# Set the possible values of build type for cmake-gui
Expand Down Expand Up @@ -225,6 +225,9 @@ include(CheckCompilerCapabilities)
if(SUPPORT_FOR_MPI_IERROR_KEYWORD)
add_compile_definitions(SUPPORT_FOR_MPI_IERROR_KEYWORD)
endif()
if (APPLE)
add_compile_definitions("-D__DARWIN")
endif()

add_subdirectory (pfio)
add_subdirectory (profiler)
Expand Down
4 changes: 2 additions & 2 deletions base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set (srcs
MAPL_IO.F90
MAPL_LatLonGridFactory.F90 MAPL_TransposeRegridder.F90
MAPL_Comms.F90 MAPL_LatLonToLatLonRegridder.F90 MAPL_TripolarGridFactory.F90
MAPL_LlcGridFactory.F90
MAPL_LlcGridFactory.F90 MAPL_SwathGridFactory.F90
MAPL_Config.F90 MAPL_LocStreamMod.F90
MAPL_ConservativeRegridder.F90 MAPL_MaxMinMod.F90 MAPL_VerticalInterpMod.F90
MAPL_CubedSphereGridFactory.F90 MAPL_MemUtils.F90 MAPL_VerticalMethods.F90
Expand All @@ -55,7 +55,7 @@ set (srcs
MAPL_Resource.F90
MAPL_XYGridFactory.F90
MAPL_NetCDF.F90 Plain_netCDF_Time.F90
MAPL_DateTime_Parsing_ESMF.F90
MAPL_DateTime_Parsing_ESMF.F90 MAPL_ObsUtil.F90
# Orphaned program: should not be in this library.
# tstqsat.F90
)
Expand Down
52 changes: 51 additions & 1 deletion base/MAPL_AbstractGridFactory.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ module MAPL_AbstractGridFactoryMod
procedure(get_file_format_vars), deferred :: get_file_format_vars
procedure(decomps_are_equal), deferred :: decomps_are_equal
procedure(physical_params_are_equal), deferred :: physical_params_are_equal

procedure :: get_xy_subset
procedure :: get_xy_mask
procedure :: destroy
procedure :: get_obs_time
end type AbstractGridFactory

abstract interface
Expand Down Expand Up @@ -238,6 +243,7 @@ function generate_file_reference3D(this,fpointer,metadata) result(ref)
type(FileMetadata), intent(in), optional :: metaData
end function generate_file_reference3D


end interface

character(len=*), parameter :: MOD_NAME = 'MAPL_AbstractGridFactory::'
Expand Down Expand Up @@ -1030,5 +1036,49 @@ function get_grid(this, unusable, rc) result(grid)
end if

end function get_grid



! This procedure should only be called for time dependent grids.
! A default implementation is to fail for other grid types, so we do not
! have to explicitly add methods to all of the existing subclasses.
subroutine get_xy_subset(this, interval, xy_subset, rc)
class(AbstractGridFactory), intent(in) :: this
type(ESMF_Time), intent(in) :: interval(2)
integer, intent(out) :: xy_subset(2,2)
integer, optional, intent(out) :: rc
integer :: status

_RETURN(_FAILURE)
end subroutine get_xy_subset

subroutine get_xy_mask(this, interval, xy_mask, rc)
class(AbstractGridFactory), intent(inout) :: this
type(ESMF_Time), intent(in) :: interval(2)
integer, allocatable, intent(out) :: xy_mask(:,:)
integer, optional, intent(out) :: rc
integer :: status

_RETURN(_FAILURE)
end subroutine get_xy_mask

! Probably don't need to do anything more for subclasses unless they have
! other objects that don't finalize well. (NetCDF, ESMF, MPI, ...)
subroutine destroy(this, rc)
class(AbstractGridFactory), intent(inout) :: this
integer, optional, intent(out) :: rc
integer :: status

call ESMF_GridDestroy(this%grid, noGarbage=.true., _RC)
_RETURN(_SUCCESS)
end subroutine destroy

subroutine get_obs_time(this, grid, obs_time, rc)
class(AbstractGridFactory), intent(inout) :: this
type (ESMF_Grid), intent(in) :: grid
real(ESMF_KIND_R4), intent(out) :: obs_time(:,:)
integer, optional, intent(out) :: rc

_RETURN(_SUCCESS)
end subroutine get_obs_time

end module MAPL_AbstractGridFactoryMod
21 changes: 21 additions & 0 deletions base/MAPL_AbstractRegridder.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module MAPL_AbstractRegridderMod
use ESMF
use MAPL_MemUtilsMod
use MAPL_ExceptionHandling
use MAPL_RegridderSpecRouteHandleMap
use, intrinsic :: iso_fortran_env, only: REAL32, REAL64
implicit none
private
Expand Down Expand Up @@ -92,6 +93,9 @@ module MAPL_AbstractRegridderMod
procedure :: has_undef_value
procedure :: get_regrid_method

procedure :: destroy
procedure :: destroy_route_handle

end type AbstractRegridder


Expand Down Expand Up @@ -1006,4 +1010,21 @@ integer function get_regrid_method(this) result(method)
method = this%spec%regrid_method
end function get_regrid_method


subroutine destroy(this, rc)
class(AbstractRegridder), intent(inout) :: this
integer, optional, intent(out) :: rc
integer :: status

_RETURN(_SUCCESS)
end subroutine destroy

subroutine destroy_route_handle(this, kind, rc)
class(AbstractRegridder), intent(inout) :: this
type(ESMF_TypeKind_Flag), intent(in) :: kind
integer, optional, intent(out) :: rc

_RETURN(_SUCCESS)
end subroutine destroy_route_handle

end module MAPL_AbstractRegridderMod
3 changes: 2 additions & 1 deletion base/MAPL_Config.F90
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ function MAPL_ConfigCreate(unusable, rc) result(config)
#endif
character, parameter :: NUL = achar(00) !! what it says

_UNUSED_DUMMY(unusable)
config = ESMF_ConfigCreate(rc=rc)
config%cptr%buffer(1:1) = EOL
config%cptr%buffer(2:2) = EOB
config%cptr%nbuf = 2
config%cptr%next_line = 1
config%cptr%value_begin = 1

_RETURN(_SUCCESS)
_UNUSED_DUMMY(unusable)
end function MAPL_ConfigCreate

!------------------------------------------------------------------------------
Expand Down
52 changes: 52 additions & 0 deletions base/MAPL_EsmfRegridder.F90
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ module MAPL_EsmfRegridderMod
procedure :: do_regrid
procedure :: create_route_handle
procedure :: select_route_handle
procedure :: destroy
procedure :: destroy_route_handle

end type EsmfRegridder

Expand Down Expand Up @@ -1600,4 +1602,54 @@ function select_route_handle(this, kind, do_transpose, rc) result(route_handle)

end function select_route_handle

subroutine destroy(this, rc)
class(EsmfRegridder), intent(inout) :: this
integer, optional, intent(out) :: rc
integer :: status

call this%destroy_route_handle(ESMF_TYPEKIND_R4, _RC)

_RETURN(_SUCCESS)
end subroutine destroy


subroutine destroy_route_handle(this, kind, rc)
class(EsmfRegridder), intent(inout) :: this
type(ESMF_TypeKind_Flag), intent(in) :: kind
integer, optional, intent(out) :: rc

type (RegridderSpec) :: spec
type(ESMF_RouteHandle) :: dummy_rh
type(RegridderSpecRouteHandleMap), pointer :: route_handles, transpose_route_handles
type(ESMF_RouteHandle) :: route_handle
type(RegridderSpecRouteHandleMapIterator) :: iter
integer :: status

if (kind == ESMF_TYPEKIND_R4) then
route_handles => route_handles_r4
transpose_route_handles => transpose_route_handles_r4
else if(kind == ESMF_TYPEKIND_R8) then
route_handles => route_handles_r8
transpose_route_handles => transpose_route_handles_r8
else
_FAIL('unsupported type kind (must be R4 or R8)')
end if

spec = this%get_spec()

_ASSERT(route_handles%count(spec) == 1, 'Did not find this spec in route handle table.')
route_handle = route_handles%at(spec)
call ESMF_RouteHandleDestroy(route_handle, noGarbage=.true.,_RC)
iter = route_handles%find(spec)
call route_handles%erase(iter)

_ASSERT(transpose_route_handles%count(spec) == 1, 'Did not find this spec in route handle table.')
route_handle = transpose_route_handles%at(spec)
call ESMF_RouteHandleDestroy(route_handle, noGarbage=.true., _RC)
iter = transpose_route_handles%find(spec)
call transpose_route_handles%erase(iter)

_RETURN(_SUCCESS)
end subroutine destroy_route_handle

end module MAPL_EsmfRegridderMod
Loading

0 comments on commit edbe07d

Please sign in to comment.