Skip to content

Commit

Permalink
Merge pull request #1996 from GEOS-ESM/develop
Browse files Browse the repository at this point in the history
GitFlow: Merge Develop into main for 2.35 release
  • Loading branch information
tclune committed Mar 1, 2023
2 parents ecbaecd + 76d99ce commit a6af7b1
Show file tree
Hide file tree
Showing 51 changed files with 2,116 additions and 1,876 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ workflows:
baselibs_version: *baselibs_version
repo: MAPL
mepodevelop: false
extra_cmake_options: "-DBUILD_WITH_FLAP=OFF -DBUILD_WITH_PFLOGGER=OFF -DBUILD_SHARED_MAPL=OFF"
extra_cmake_options: "-DBUILD_WITH_FLAP=OFF -DBUILD_WITH_PFLOGGER=OFF -DBUILD_WITH_FARGPARSE=OFF -DUSE_EXTDATA2G=OFF -DBUILD_SHARED_MAPL=OFF"
run_unit_tests: true
ctest_options: "-LE 'PERFORMANCE|EXTDATA1G_BIG_TESTS|EXTDATA2G_BIG_TESTS' --output-on-failure"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push-to-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
with:
fetch-depth: 0
- name: Run the action
uses: devops-infra/action-pull-request@v0.5.3
uses: devops-infra/action-pull-request@v0.5.5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: develop
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
with:
fetch-depth: 0
- name: Run the action
uses: devops-infra/action-pull-request@v0.5.3
uses: devops-infra/action-pull-request@v0.5.5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: main
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
with:
path: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}

- name: Checkout mepo
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
with:
repository: GEOS-ESM/mepo
path: mepo
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 @@ -15,7 +15,7 @@ jobs:
validate-YAML:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.2.0
- uses: actions/checkout@v3.3.0
- id: yaml-lint
name: yaml-lint
uses: ibiqlik/action-yamllint@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
with:
fetch-depth: 1
- name: Set all directories as git safe
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3.2.0
uses: actions/checkout@v3.3.0
with:
fetch-depth: 1
- name: Set all directories as git safe
Expand Down
2 changes: 1 addition & 1 deletion Apps/Regrid_Util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ subroutine process_command_line(this,rc)
if (.not.allocated(this%tripolar_file_out)) then
this%tripolar_file_out = "empty"
end if
this%regridMethod = get_regrid_method(regridMth)
this%regridMethod = regrid_method_string_to_int(regridMth)
_ASSERT(this%regridMethod/=UNSPECIFIED_REGRID_METHOD,"improper regrid method chosen")

this%filenames = split_string(cfilenames,',')
Expand Down
47 changes: 47 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,53 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Deprecated

## [2.35.0] - 2023-03-01

### Added

- Added subroutines to read char type in Netcdf
- Added a subroutine add_variable to Netcdf4_Fileformatter
- Add a function to get the area of a spherical polygon to the spherical geometry module
- Created layout independent version of the "DownBit"/"pFIO_ShaveMantissa" routines when running in MPI codes
- Added subroutine `MAPL_SunGetLocalSolarHourAngle()` in `base/MAPL_sun_uc.F90`. This
provides a convenient local solar hour angle diagnostic which will be used to detect local
solar noon via the `EXAMPLE OF USE` in the subroutine header. See `DESCRIPTION` in code
for more details. Provides the TRUE local solar hour angle (i.e., with equation of time
included), but can also provide the MEAN value (without EOT) via `FORCE_MLSHA=.TRUE.`
optional argument.
- Add `shavemantissa` f2py code. This is used by AeroApps.
- NOTE: If you do not have a need for this code, build with `-DUSE_F2PY=OFF`. Note that even if you try to build the f2py code, it might fail anyway due to issues with the Python stack on the machine. ESMA_cmake has code that "tests" if f2py works. If it doesn't, it should failover gracefully.

### Changed

- Changed set_grid method so users have a chance to specify the grid type
- Renamed `get_regrid_method` and `translate_regrid_method` to `regrid_method_string_to_int` and `regrid_method_int_to_string`
respectively in `RegridMethods.F90`. This was done so we could add `get_regrid_method` to the AbstractRegridder. The new names
more accurately reflect what the RegridMethods functions do.
- Changed call to `MAPL_SunOrbitCreate()` inside `MAPL_Generic.F90` to call to new function
`MAPL_SunOrbitCreateFromConfig()`, the latter which get the orbital parameters from the MAPL
state's Config. In this way no default orbital parameter values need appear in `MAPL_Generic.F90`.
Rather, these default values are encapsulated where they belong in `Sun_Mod` in `base/MAPL_sun_uc.F90`
and are now explicitly named and commented on at the head of the module. This is a structural
zero-diff change.
- Created `MAPL.profiler` logger and moved throughput, per-component, and global timers to use it
- Moved most of the MAPL_GetResource generic subroutine to a new module, MAPL_ResourceMod, in base.
The specific subroutines remain in MAPL_GenericMod to maintain the interface in one module, but
most of the functionality is in MAPL_ResourceMod now.
- Update "build like UFS" CI test
- Converted the History Gridded Component to use `_RC` and `_STAT` macros

### Fixed

- Changed the type of output counters to INT64 for large file.
- Tested optional arguments arrdes in MAPL_WriteVars
- Added the correct values to halo corner of LatLon grid
- Fixed range in halo of LatLonGridFactory
- Corrected issue with native output having metadata saying it was bilinearly regridded. Now sets these files to have
`regrid_method: identity`
- Fix bug in `mapl_acg.cmake` that caused unnecessary rebuilds
- Fixed error handling for refactored MAPL_GetResource

## [2.34.3] - 2023-02-14

### Added
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_policy (SET CMP0054 NEW)

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

# Set the default build type to release
Expand Down
20 changes: 20 additions & 0 deletions MAPL_cfio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,23 @@ if (precision MATCHES "r8")
target_compile_options (${lib} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:${flag}>)
endforeach ()
endif ()

if (USE_F2PY)
if (precision STREQUAL "r4")
find_package(F2PY2)
if (F2PY2_FOUND)
esma_add_f2py2_module(ShaveMantissa_
SOURCES ShaveMantissa_py.F90 ShaveMantissa.c
DESTINATION lib/Python/${this}
INCLUDEDIRS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/lib ${include_${this}}
)
add_dependencies(ShaveMantissa_ ${this})

# Install the Python files
install (
FILES shavemantissa.py
DESTINATION lib/Python/${this}
)
endif ()
endif ()
endif ()
26 changes: 26 additions & 0 deletions MAPL_cfio/ShaveMantissa_py.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
subroutine Shave32 ( a_shaved, a, n, xbits, has_undef, undef, chunksize, rc )

!
! Simple cover for f2py.
!
use iso_fortran_env, only: REAL32
implicit NONE
integer, intent(in) :: n ! array size
real(kind=REAL32), intent(in) :: a(n) ! array to be shaved, usually 2D
integer, intent(in) :: xbits ! number of mantissa bits to zero (out of 24)
integer, intent(in) :: has_undef ! set to 1 if undef is present, 0 otherwise
real(kind=REAL32), intent(in) :: undef ! undef value
integer, intent(in) :: chunksize ! find mid-range over chunksizes

real(kind=REAL32), intent(out) :: a_shaved(n) ! shaved array
integer, intent(out) :: rc ! error code

! ---

integer, external :: ShaveMantissa32

rc = ShaveMantissa32(a_shaved,a,n,xbits,has_undef,undef,chunksize)

end subroutine Shave32


36 changes: 36 additions & 0 deletions MAPL_cfio/shavemantissa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""
SImple python interface to the ShaveMantissa function
"""

MISSING = 1.0E15

from ShaveMantissa_ import shave32

def shave(a,xbits=12,has_undef=0,undef=MISSING,chunksize=-1):
"""
Shaves bits from mantissa of float point array for better netCDF4 compression
using gzip.
a_shaved = shave(a,...)
xbits --- number of bits to shave
has_undef --- set to 1 if undefs are present
undef --- undef value
chunksize --- for scaling of array to be shaved: find mid-range value
over chunksizes. If negative, set to len(a)
Typically this function is used for a single vertical slice at time.
"""

n = len(a)
if chunksize<0: chunksize = n

a_shaved, rc = shave32(a,xbits,has_undef,undef,chunksize)

if rc:
raise ValueError, 'shave: error on return from ShaveMantissa_.shave32: %d'%rc

return a_shaved

5 changes: 3 additions & 2 deletions Python/MAPL/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
MAPL_DEGREES_TO_RADIANS = MAPL_PI / 180.0
MAPL_RADIANS_TO_DEGREES = 180.0 / MAPL_PI

MAPL_UNDEF = 1.0e15

MAPL_PSDRY = 98305.0 # dry surface pressure [Pa]
MAPL_SECONDS_PER_SIDEREAL_DAY = 86164.0 #s
MAPL_GRAV = 9.80665 # m^2/s
MAPL_RADIUS = 6371.0E3 # m
MAPL_OMEGA = 2.0*MAPL_PI/MAPL_SECONDS_PER_SIDEREAL_DAY # 1/s
MAPL_RUNIV = 8314.47 # J/(Kmole K)
MAPL_H2OMW = 18.015 # kg/Kmole
MAPL_EARTH_ECCENTRICITY = 8.1819190842622E-2 # --
MAPL_EARTH_SEMIMAJOR_AXIS = 6378137 # m
MAPL_KM_PER_DEG = (1.0/(MAPL_RADIUS/1000.)) * MAPL_RADIANS_TO_DEGREES
Expand Down Expand Up @@ -48,9 +51,7 @@

MAPL_STFBOL = 5.6734E-8 # W/(m^2 K^4)
MAPL_AVOGAD = 6.023E26 # 1/kmol
MAPL_RUNIV = 8314.47 # J/(Kmole K)

MAPL_H2OMW = 18.015 # kg/Kmole
MAPL_O3MW = 47.9982 # kg/Kmole
MAPL_ALHL = 2.4665E6 # J/kg @15C
MAPL_ALHF = 3.3370E5 # J/kg
Expand Down
22 changes: 12 additions & 10 deletions base/ApplicationSupport.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ subroutine MAPL_Initialize(unusable,comm,logging_config,rc)

character(:), allocatable :: logging_configuration_file
integer :: comm_world,status

_UNUSED_DUMMY(unusable)

if (present(logging_config)) then
Expand Down Expand Up @@ -55,7 +55,7 @@ subroutine MAPL_Finalize(unusable,comm,rc)
integer :: comm_world,status

_UNUSED_DUMMY(unusable)

if (present(comm)) then
comm_world = comm
else
Expand Down Expand Up @@ -137,7 +137,7 @@ subroutine initialize_pflogger(unusable,comm,logging_config,rc)

if (rank == 0) then
lgr => logging%get_logger('MAPL')
call lgr%warning('No configure file specified for logging layer. Using defaults.')
call lgr%warning('No configure file specified for logging layer. Using defaults.')
end if

end if
Expand All @@ -158,6 +158,7 @@ subroutine report_global_profiler(unusable,comm,rc)
integer :: npes, my_rank, ierror
character(1) :: empty(0)
class (BaseProfiler), pointer :: t_p
type(Logger), pointer :: lgr

_UNUSED_DUMMY(unusable)
if (present(comm)) then
Expand Down Expand Up @@ -185,13 +186,14 @@ subroutine report_global_profiler(unusable,comm,rc)
call MPI_Comm_Rank(world_comm, my_rank, ierror)

if (my_rank == 0) then
report_lines = reporter%generate_report(t_p)
write(*,'(a,1x,i0)')'Report on process: ', my_rank
do i = 1, size(report_lines)
write(*,'(a)') report_lines(i)
end do
end if
call MPI_Barrier(world_comm, ierror)
report_lines = reporter%generate_report(t_p)
lgr => logging%get_logger('MAPL.profiler')
call lgr%info('Report on process: %i0', my_rank)
do i = 1, size(report_lines)
call lgr%info('%a', report_lines(i))
end do
end if
call MPI_Barrier(world_comm, ierror)

end subroutine report_global_profiler

Expand Down
1 change: 1 addition & 0 deletions base/Base.F90
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module MAPLBase_Mod
use MAPL_FileMetadataUtilsMod
use MAPL_VerticalDataMod
use MAPL_FieldUtilities
use MAPL_SphericalGeometry
logical, save, private :: mapl_is_initialized = .false.

end module MAPLBase_Mod
4 changes: 3 additions & 1 deletion base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ set (srcs
TimeStringConversion.F90
MAPL_ISO8601_DateTime_ESMF.F90
FieldUtilities.F90
MAPL_Resource.F90
# Orphaned program: should not be in this library.
# tstqsat.F90
)


esma_add_library(
${this} SRCS ${srcs}
DEPENDENCIES MAPL.shared MAPL.constants MAPL.profiler MAPL.pfio MAPL_cfio_r4 PFLOGGER::pflogger GFTL_SHARED::gftl-shared
DEPENDENCIES MAPL.shared MAPL.constants MAPL.profiler MAPL.pfio MAPL_cfio_r4 PFLOGGER::pflogger
GFTL_SHARED::gftl-shared-v2 GFTL_SHARED::gftl-shared-v1 GFTL::gftl-v2 GFTL::gftl-v1
esmf NetCDF::NetCDF_Fortran MPI::MPI_Fortran
TYPE ${MAPL_LIBRARY_TYPE})

Expand Down
Loading

0 comments on commit a6af7b1

Please sign in to comment.