Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into dmUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
rem1776 authored and rem1776 committed Dec 15, 2023
2 parents 8d6373d + ac0d086 commit 0cd1174
Show file tree
Hide file tree
Showing 40 changed files with 2,637 additions and 842 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ and this project uses `yyyy.rr[.pp]`, where `yyyy` is the year a patch is releas
`rr` is a sequential release number (starting from `01`), and an optional two-digit
sequential patch number (starting from `01`).

## [2023.04] - 2023-12-04
### Known Issues
- GCC 9 and below as well as GCC 11.1.0 are unsupported due to compilation issues. See prior releases for more details.
- `NO_QUAD_PRECISION` macro is no longer set by FMS, the `ENABLE_QUAD_PRECISION` macro has replaced prior usage of `NO_QUAD_PRECISION`. `-DENABLE_QUAD_PRECISION` should be set if quad precision is to be used, otherwise FMS will not use quad precision reals where applicable.

### Added
- DATA_OVERRIDE: A new namelist flag `use_data_table_yaml` has been added to enable usage of the yaml format data_override tables. This allows an executable built with yaml support be able to accept either format.

### Changed
- RESERVED KEYWORD CHANGES: Various routines in FMS have been updated to not use fortran keywords for variable names. The names changed were: `data`, `unit`, and `value`. This may affect usage of external code if argument names are explicitly used. Only required arguement names were changed to mitigate any breaking changes.
- TESTS: Changes the testing scripts to allow for the `MPI_LAUNCHER` environment variable override to work with any provided arguments.

### Fixed
- CMAKE: Fixed build issue with CMake where precision default flags were being overwritten when using GNU and MPICH.
- AUTOTOOLS: Fixes issue affecting installs where the global libFMS.F90 module was not being installed correctly and adds post-install message.
- DIAG_MANAGER: Fixes issue with incorrect start_time functionality (from the 2023.02.01 patch)

### Tag Commit Hashes
- 2023.04-beta1 be1856c45accfe2fb15953c5f51e0d58a8816882

## [2023.03] - 2023-10-27
### Known Issues
- GCC 9 and below as well as GCC 11.1.0 are unsupported due to compilation issues. See prior releases for more details.
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set(CMAKE_Fortran_FLAGS_DEBUG)

# Define the CMake project
project(FMS
VERSION 2023.03.0
VERSION 2023.04.0
DESCRIPTION "GFDL FMS Library"
HOMEPAGE_URL "https://www.gfdl.noaa.gov/fms"
LANGUAGES C Fortran)
Expand Down
106 changes: 67 additions & 39 deletions axis_utils/include/axis_utils2.inc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
!! indicating to reproduce the mpp_io bug where
!! the null characters were not removed after reading a string attribute
integer, parameter :: lkind = FMS_AU_KIND_
integer :: edge_index(2) !< Index to use when reading the edges from the file
!! (/1, 2/) if the axis data is monotonically increasing
!! (/2, 1/) if the axis data is monotonically decreasing
ndims = get_variable_num_dimensions(fileobj, name)
allocate(dim_sizes(ndims))
Expand Down Expand Up @@ -108,8 +111,10 @@
allocate(r2d(dim_sizes(1), dim_sizes(2)))
call read_data(fileobj, buffer, r2d)
edge_data(1:dim_sizes(2)) = r2d(1,:)
edge_data(dim_sizes(2)+1) = r2d(2,dim_sizes(2))
edge_index = (/1, 2/)
if (r2d(1,1) .gt. r2d(1,2)) edge_index = (/2, 1 /)
edge_data(1:dim_sizes(2)) = r2d(edge_index(1),:)
edge_data(dim_sizes(2)+1) = r2d(edge_index(2),dim_sizes(2))
deallocate(r2d)
endif
deallocate(dim_sizes)
Expand Down Expand Up @@ -265,7 +270,7 @@
!! inputs:
!!
!! rval = arbitrary data...same units as elements in "array"
!! array = array of data points (must be monotonically increasing)
!! array = array of data points (must be monotonically)
!! ia = dimension of "array"
!!
!! output:
Expand Down Expand Up @@ -293,48 +298,71 @@
!! z(k1) would be the nearest data point to 12.5 and z(k2) would
!! be the nearest data point to 0.0
!! @return integer nearest_index
function NEAREST_INDEX_(rval, array)
real(kind=FMS_AU_KIND_), intent(in) :: rval !< arbitrary data...same units as elements in "array"
real(kind=FMS_AU_KIND_), intent(in), dimension(:) :: array !< array of data points (must be monotonic)
integer :: NEAREST_INDEX_
integer :: ia !< dimension of "array"
integer :: i, ii, iunit
real(kind=FMS_AU_KIND_) :: rval !< arbitrary data...same units as elements in "array"
real(kind=FMS_AU_KIND_), dimension(:) :: array !< array of data points (must be monotonically increasing)
logical :: keep_going
ia = size(array(:))
do i = 2, ia
if (array(i) < array(i-1)) then
iunit = stdout()
write (iunit,*) '=> Error: "nearest_index" array must be monotonically increasing' &
& // 'when searching for nearest value to ', rval
write (iunit,*) ' array(i) < array(i-1) for i=',i
write (iunit,*) ' array(i) for i=1..ia follows:'
do ii = 1, ia
write (iunit,*) 'i=',ii, ' array(i)=', array(ii)
enddo
call mpp_error(FATAL,' "nearest_index" array must be monotonically increasing.')
endif
enddo
integer :: i !< For looping through "array"
ia = SIZE(array(:))
! check if array is monotonous
DO i = 2, ia-1
IF( (array(i-1)<array(i).AND.array(i)>array(i+1)) .OR. (array(i-1)>array(i).AND.array(i)<array(i+1))) THEN
! <ERROR STATUS="FATAL">array NOT monotonously ordered</ERROR>
CALL mpp_error(FATAL, 'axis_utils2::nearest_index array is NOT monotonously ordered')
END IF
END DO
if (array(1) < array(ia)) then
!< increasing array
!< Check if the rval is outside the range of the array
if (rval < array(1)) then
NEAREST_INDEX_ = 1
return
elseif (rval > array(ia)) then
NEAREST_INDEX_ = ia
return
endif
if (rval < array(1) .or. rval > array(ia)) then
if (rval < array(1)) NEAREST_INDEX_ = 1
if (rval > array(ia)) NEAREST_INDEX_ = ia
DO i = 1, ia-1
IF ( (array(i)<=rval).AND.(array(i+1)>= rval) ) THEN
IF( rval - array(i) <= array(i+1) - rval ) THEN
NEAREST_INDEX_ = i
return
ELSE
NEAREST_INDEX_ = i+1
return
ENDIF
EXIT
END IF
END DO
else
i = 1
keep_going = .true.
do while (i <= ia .and. keep_going)
i = i+1
if (rval <= array(i)) then
NEAREST_INDEX_ = i
if (array(i)-rval > rval-array(i-1)) NEAREST_INDEX_ = i-1
keep_going = .false.
endif
enddo
!< Decreasing Array
!< Check if the rval is outside the range of the array
if (rval < array(ia)) then
NEAREST_INDEX_ = ia
return
elseif (rval > array(1)) then
NEAREST_INDEX_ = 1
return
endif
DO i = 1, ia-1
IF ( (array(i)>=rval).AND.(array(i+1)<= rval) ) THEN
IF ( array(i)-rval <= rval-array(i+1) ) THEN
NEAREST_INDEX_ = i
return
ELSE
NEAREST_INDEX_ = i+1
return
END IF
END IF
END DO
endif
end function NEAREST_INDEX_
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ AC_PREREQ([2.69])

# Initialize with name, version, and support email address.
AC_INIT([GFDL FMS Library],
[2023.03.00-dev],
[2023.04.00-dev],
[[email protected]],
[FMS],
[https://www.github.com/NOAA-GFDL/FMS])
Expand Down
7 changes: 7 additions & 0 deletions data_override/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ If it is desired to interpolate the data to a region of the model grid. The foll
- **lat_start:** The starting longitude in the same units as the grid data in the file
- **lon_end:** The ending longitude in the same units as the grid data in the file

If it is desired to use multiple(3) input netcdf files instead of 1. The following **optional** keys are available.
- **is_multi_file:** Set to `True` is using the multi-file feature
- **prev_file_name:** The name of the first file in the set
- **next_file_name:** The name of the third file in the set

Note that **file_name** must be the second file in the set. **prev_file_name** and/or **next_file_name** are required if **is_multi_file** is set to `True`

#### 2. How to use it?
In order to use the yaml data format, [libyaml](https://github.com/yaml/libyaml) needs to be installed and linked with FMS. Additionally, FMS must be compiled with -Duse_yaml macro. If using autotools, you can add `--with-yaml`, which will add the macro for you and check that libyaml is linked correctly.
```
Expand Down
Loading

0 comments on commit 0cd1174

Please sign in to comment.