Skip to content

Commit

Permalink
Merge pull request #619 from NCAR/fortran_standards
Browse files Browse the repository at this point in the history
Fortran standards bug-fixes
  • Loading branch information
hkershaw-brown authored Feb 13, 2024
2 parents 82f7e91 + dc12693 commit 77bb8c2
Show file tree
Hide file tree
Showing 19 changed files with 189 additions and 230 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ ssec_satwnd
gts_to_dart
littler_tf_dart
rad_3dvar_to_dart
L1_AMSUA_to_netcdf
convert_airs_L2
convert_amsu_L1
convert_L2b

# Test programs built by developer_tests
rttov_test
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ individual files.

The changes are now listed with the most recent at the top.

**February 13 2024 :: Fortran Standards. Tag v11.0.3**

- Replace f2kcli with Fortran intrinsics for command line arguments.
- AIRS and quikscat mkmf.templates with appropriate HDF, HDFEOS, RTTOV library flags.
- Simplified noah_hydro_mod.f90 number of non-zero element counts.
- WRF pert_sounding_module random iseed now integer.

**February 1 2024 :: RTTOV13 cloud bug-fix. Tag v11.0.2**

- Initialize RTTOV13 profile cloud arrays to zero for profiles.
Expand Down
41 changes: 41 additions & 0 deletions build_templates/mkmf.template.AIRS.gfortran
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Template for AIRS observation converter with GNU gfortran on Linux or OSX
#
# DART software - Copyright UCAR. This open source software is provided
# by UCAR, "as is", without charge, subject to all terms of use at
# http://www.image.ucar.edu/DAReS/DART/DART_download


MPIFC = mpif90
MPILD = mpif90
FC = gfortran
LD = h4fc

# MODIFY THE FOLLOWING VARIABLES FOR YOUR SYSTEM:
# If your NETCDF, HDFEOS, or RTTOV environment variables are not set,
# uncomment the following line and set value to where lib and include
# are found for the netcdf files that match this compiler.
#
# NETCDF = /opt/local
HDFEOS = /glade/campaign/cisl/dares/libraries/hdf-eos_gfortran
RTTOV = /glade/campaign/cisl/dares/libraries/rttov123_gfortran

RTTOV_VERSION = 12

RTLIBS = -lrttov$(RTTOV_VERSION)_wrapper -lrttov$(RTTOV_VERSION)_mw_scatt -lrttov$(RTTOV_VERSION)_brdf_atlas \
-lrttov$(RTTOV_VERSION)_emis_atlas -lrttov$(RTTOV_VERSION)_other -lrttov$(RTTOV_VERSION)_parallel \
-lrttov$(RTTOV_VERSION)_coef_io -lrttov$(RTTOV_VERSION)_hdf -lrttov$(RTTOV_VERSION)_main

INCS = -I$(NETCDF)/include -I$(HDFEOS)/include -I$(RTTOV)/include -I$(RTTOV)/mod

LIBS = -L$(NETCDF)/lib -lnetcdff -lnetcdf \
-L$(HDFEOS)/lib -lhdfeos -lmfhdf -ldf -ljpeg -lz -lm -lsz \
-L$(RTTOV)/lib -lhdf5_hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 $(RTLIBS)

FFLAGS = -O2 -ffree-line-length-none -fallow-argument-mismatch $(INCS)
LDFLAGS = $(FFLAGS) $(LIBS)

# Debug settings (preferably also use a RTTOV compiled with debug settings):
#
# FFLAGS = -g -Wuninitialized -Wunused -ffree-line-length-none -fbounds-check \
# -fbacktrace -ffpe-trap=invalid,zero,overflow -fallow-argument-mismatch $(INCS)

42 changes: 42 additions & 0 deletions build_templates/mkmf.template.AIRS.intel
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Template for AIRS observation converter with Intel Fortran Compiler on Linux or OSX
#
# DART software - Copyright UCAR. This open source software is provided
# by UCAR, "as is", without charge, subject to all terms of use at
# http://www.image.ucar.edu/DAReS/DART/DART_download

MPIFC = mpif90
MPILD = mpif90
FC = h4fc
LD = h4fc

# MODIFY THE FOLLOWING VARIABLES FOR YOUR SYSTEM:
# If your NETCDF, HDFEOS, or RTTOV environment variables are not set,
# uncomment the following line and set value to where lib and include
# are found for the netcdf files that match this compiler.
#
# NETCDF = /opt/local
HDFEOS = /glade/campaign/cisl/dares/libraries/hdf-eos_intel/
RTTOV = /glade/campaign/cisl/dares/libraries/rttov123_intel/

RTTOV_VERSION = 12

RTLIBS = -lrttov$(RTTOV_VERSION)_wrapper -lrttov$(RTTOV_VERSION)_mw_scatt -lrttov$(RTTOV_VERSION)_brdf_atlas \
-lrttov$(RTTOV_VERSION)_emis_atlas -lrttov$(RTTOV_VERSION)_other -lrttov$(RTTOV_VERSION)_parallel \
-lrttov$(RTTOV_VERSION)_coef_io -lrttov$(RTTOV_VERSION)_hdf -lrttov$(RTTOV_VERSION)_main

INCS = -I$(NETCDF)/include -I$(HDFEOS)/include -I$(RTTOV)/include -I$(RTTOV)/mod

LIBS = -L$(NETCDF)/lib -lnetcdff -lnetcdf \
-L$(HDFEOS)/lib -lhdfeos -lmfhdf -ldf -ljpeg -lz -lm -lsz -lGctp \
-L$(RTTOV)/lib -lhdf5_hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 $(RTLIBS)

FFLAGS = -O2 -assume buffered_io $(INCS)
LDFLAGS = $(FFLAGS) $(LIBS)

# for development or debugging, use this instead:
# FFLAGS = -g -C -check noarg_temp_created -fpe0 \
# -fp-model precise -ftrapuv -traceback \
# -warn declarations,uncalled,unused $(INCS)

# Optimized (BLAS, LAPACK) libraries are available from the Intel Math Kernel Libraries:
# -lmkl -lmkl_lapack -lguide -lpthread
31 changes: 31 additions & 0 deletions build_templates/mkmf.template.quikscat.gfortran
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Template for quikscat converter with GNU gfortran on Linux or Mac OSX
#
# DART software - Copyright UCAR. This open source software is provided
# by UCAR, "as is", without charge, subject to all terms of use at
# http://www.image.ucar.edu/DAReS/DART/DART_download
#


MPIFC = mpif90
MPILD = mpif90
FC = gfortran
LD = h4fc

# If you get an error "ld: library not found for -lnetcdff" (note 2 f's),
# remove it from the LIBS line. The same is true for any library. If 'ld'
# does not complain - it worked.

# If your NETCDF environment variable is not set correctly,
# uncomment the following line and set value to where lib and include
# are found for the netcdf files that match this compiler.
#
# NETCDF = /opt/local

INCS = -I$(NETCDF)/include
LIBS = -L$(NETCDF)/lib -lnetcdff -lnetcdf
FFLAGS = -O2 -ffree-line-length-none -fallow-argument-mismatch $(INCS)
LDFLAGS = $(FFLAGS) $(LIBS)

# for development or debugging, use this instead:
# FFLAGS = -g -Wuninitialized -Wunused -ffree-line-length-none -fbounds-check \
# -fbacktrace -ffpe-trap=invalid,zero,overflow -fallow-argument-mismatch $(INCS)
37 changes: 37 additions & 0 deletions build_templates/mkmf.template.quikscat.intel
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Template for quikscat converter with Intel Fortran Compiler on Linux or OSX
#
# DART software - Copyright UCAR. This open source software is provided
# by UCAR, "as is", without charge, subject to all terms of use at
# http://www.image.ucar.edu/DAReS/DART/DART_download
#

MPIFC = mpif90
MPILD = mpif90
FC = h4fc
LD = h4fc

# If you get an error "ld: library not found for -lnetcdff" (note 2 f's),
# remove it from the LIBS line. The same is true for any library. If 'ld'
# does not complain - it worked.

# If your NETCDF environment variable is not set correctly,
# uncomment the following line and set value to where lib and include
# are found for the netcdf files that match this compiler.
#
# NETCDF = /opt/local

INCS = -I$(NETCDF)/include
LIBS = -L$(NETCDF)/lib -lnetcdff -lnetcdf
FFLAGS = -O -assume buffered_io $(INCS)
LDFLAGS = $(FFLAGS) $(LIBS)

# for development or debugging, use this instead:
# FFLAGS = -g -C -check noarg_temp_created -fpe0 \
# -fp-model precise -ftrapuv -traceback \
# -warn declarations,uncalled,unused $(INCS)

# Some optimized (BLAS, LAPACK) libraries may be available with:
# LIBS = -L$(NETCDF)/lib -lnetcdff -lnetcdf -lmkl -lmkl_lapack -lguide -lpthread
#
# If you get this error: libimf.so: warning: warning: feupdateenv is not implemented
# try adding: -limf -lm to your LIBS line.
2 changes: 1 addition & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
author = 'Data Assimilation Research Section'

# The full version, including alpha/beta/rc tags
release = '11.0.2'
release = '11.0.3'
root_doc = 'index'

# -- General configuration ---------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion models/MITgcm_ocean/model_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ module model_mod
convert_vertical_obs, convert_vertical_state

use utilities_mod, only : error_handler, E_ERR, E_WARN, E_MSG, &
logfileunit, get_unit, nc_check, do_output, to_upper, &
logfileunit, get_unit, do_output, to_upper, &
find_namelist_in_file, check_namelist_read, &
open_file, file_exist, find_textfile_dims, file_to_text, &
string_to_real, string_to_logical

use netcdf_utilities_mod, only : nc_check

use obs_kind_mod, only : QTY_TEMPERATURE, QTY_SALINITY, QTY_U_CURRENT_COMPONENT, &
QTY_V_CURRENT_COMPONENT, QTY_SEA_SURFACE_HEIGHT, &
QTY_NITRATE_CONCENTRATION, QTY_SURFACE_CHLOROPHYLL, &
Expand Down
2 changes: 0 additions & 2 deletions models/wrf/WRF_BC/pert_wrf_bc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ program pert_wrf_bc

integer, dimension(4) :: dims

integer, external :: iargc

real(r8), allocatable, dimension(:,:) :: tend2d, scnd2d, frst2d

real(r8), allocatable, dimension(:,:,:) :: tend3d, scnd3d, frst3d, full3d, full3d_next
Expand Down
2 changes: 0 additions & 2 deletions models/wrf/WRF_BC/update_wrf_bc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ program update_wrf_bc

integer, dimension(4) :: dims

integer, external :: iargc

real(r8), allocatable, dimension(:,:) :: tend2d, scnd2d, frst2d

real(r8), allocatable, dimension(:,:,:) :: tend3d, scnd3d, frst3d, full3d, full3d_mean
Expand Down
1 change: 0 additions & 1 deletion models/wrf/WRF_DART_utilities/add_pert_where_high_refl.f90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ PROGRAM add_pert_where_high_refl
use utilities_mod, only : error_handler, E_ERR, initialize_utilities, finalize_utilities
use random_seq_mod, only : random_gaussian, random_seq_type, init_random_seq
use netcdf
use f2kcli

implicit none

Expand Down
4 changes: 2 additions & 2 deletions models/wrf/WRF_DART_utilities/advance_cymdh.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ program advance_cymdh

character(len=10) :: ccyymmddhh

nargum=iargc()
nargum=COMMAND_ARGUMENT_COUNT()

if(nargum /= 2) then
write(unit=*, fmt='(a)') &
Expand All @@ -34,7 +34,7 @@ program advance_cymdh
do n=1,80
argum(i)(n:n)=' '
enddo
call getarg(i,argum(i))
call GET_COMMAND_ARGUMENT(i,argum(i))
enddo

ccyymmddhh = trim(argum(1))
Expand Down
Loading

0 comments on commit 77bb8c2

Please sign in to comment.