Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .fortitude.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[check]
select=["E000","C031","C032","C043","C051",
"C082","C141","OB011","OB021","OB051",
"OB061","MOD001","PORT011","PORT012","PORT021",
"FORT001","FORT002","FORT003","FORT004","FORT005"]
ignore=["C091"]
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This CODEOWNERS file includes a codeowner
# who serves as a valid point of contact for
# discussing changes and seeking approval for work

**/ @mo-jmanners
**/cosp_control @Petzi1
**/cosp_github @Petzi1
16 changes: 16 additions & 0 deletions .github/workflows/lint-fortran.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -----------------------------------------------------------------------------
# (C) Crown copyright Met Office. All rights reserved.
# The file LICENCE, distributed with this code, contains details of the terms
# under which the code may be used.
# -----------------------------------------------------------------------------

name: Lint Fortran

on:
pull_request:

jobs:
fortitude-lint:
uses: MetOffice/growss/.github/workflows/fortran-lint.yaml@main
with:
runner: "ubuntu-24.04"
4 changes: 3 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
| ----------- | --------- | ----------- | ---- |
| james-bruten-mo | James Bruten | Met Office | 2025-12-09 |
| mo-jmanners | James Manners | Met Office | 2025-12-18 |
| t00sa | Sam Clarke-Green | Met Office | 20226-03-02 |
| t00sa | Sam Clarke-Green | Met Office | 2026-03-02 |
| Pierre-siddall | Pierre Siddall | Met Office | 2026-03-16 |
| nichollsh | Harrison Nicholls | University of Cambridge | 2026-03-24 |
93 changes: 65 additions & 28 deletions examples/spectral_var/run_cmip7
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Add CMIP7 solar variability data (version 4.6) to the GA9 spectral files
# This script creates the following files:
# sp_sw_ga9_cmip7_picontrol_4_6
# sp_sw_ga9_cmip7_ref_mon_4_6
# sp_sw_ga9_cmip7_ref_day_4_6
# sp_sw_ga9_cmip7_scenario_mon_4_6
# sp_sw_ga9_cmip7_scenario_day_4_6

if [ ! $SOCRATES_DATA_DIR ] ; then
SOCRATES_DATA_DIR=.
Expand All @@ -14,34 +14,53 @@ CMIP7_DATA_DIR=${SOCRATES_DATA_DIR}/solarisheppa/cmip7
PICON_FILE='multiple_input4MIPs_solar_CMIP_SOLARIS-HEPPA-CMIP-4-6_gn.nc'
MONTH_FILE='multiple_input4MIPs_solar_CMIP_SOLARIS-HEPPA-CMIP-4-6_gn_185001-202312.nc'
DAILY_FILE='multiple_input4MIPs_solar_CMIP_SOLARIS-HEPPA-CMIP-4-6_gn_18500101-20231231.nc'
FUTURE_MONFILE='multiple_input4MIPs_solar_ScenarioMIP_SOLARIS-HEPPA-ScenarioMIP-4-6_gn_202201-229912.nc'
FUTURE_DAYFILE='multiple_input4MIPs_solar_ScenarioMIP_SOLARIS-HEPPA-ScenarioMIP-4-6_gn_20220101-22991231.nc'

# Download CMIP7 solar variability data

function check_for_solaris_file () {
file_name="$1"
cloud_loc="$2"
extension="$3"
url_base="https://cloud.iaa.es/index.php/s"
# ret_file_name is the name of the file to be retrieved from SOLARIS website
if [[ "$extension" == "gz" ]]; then
ret_file_name="$file_name.$extension"
else
ret_file_name="$file_name"
fi

# if no file, then act.
if [[ ! -f $file_name ]]; then
# if the file that would be downloaded is absent, download it.
if [[ ! -f $ret_file_name ]]; then
echo "Downloading data from SOLARIS website"
echo " .... ${cloud_loc}/download/$ret_file_name"
wget $url_base/${cloud_loc}/download/$ret_file_name
fi
# if the file that has been downloaded is zipped, unzip it.
if [[ "$extension" == "gz" ]]; then
echo "Gunzipping local data"
gunzip -c $ret_file_name > $file_name
rm $ret_file_name
fi
fi
}

if [[ -r $CMIP7_DATA_DIR ]]; then
echo "Gunzipping data from $CMIP7_DATA_DIR"
gunzip -c ${CMIP7_DATA_DIR}/${PICON_FILE}.gz > ${PICON_FILE}
gunzip -c ${CMIP7_DATA_DIR}/${MONTH_FILE}.gz > ${MONTH_FILE}
gunzip -c ${CMIP7_DATA_DIR}/${DAILY_FILE}.gz > ${DAILY_FILE}
FUTURE_MONFILE=${CMIP7_DATA_DIR}/${FUTURE_MONFILE}
FUTURE_DAYFILE=${CMIP7_DATA_DIR}/${FUTURE_DAYFILE}
else
for i in $(seq 1 3); do
if [[ $i == 1 ]]; then
SOLARIS_FILE=$PICON_FILE
CLOUD_LOC='XaSb85EpGNYqkEw'
elif [[ $i == 2 ]]; then
SOLARIS_FILE=$MONTH_FILE
CLOUD_LOC='n7cacmRBjk5Gb8f'
else
SOLARIS_FILE=$DAILY_FILE
CLOUD_LOC='nJFTPcnFwZ3smTo'
fi
if [[ ! -f $SOLARIS_FILE ]]; then
if [[ ! -f $SOLARIS_FILE.gz ]]; then
echo 'Downloading data from SOLARIS website'
wget https://cloud.iaa.es/index.php/s/${CLOUD_LOC}/download/$SOLARIS_FILE.gz
fi
echo "Gunzipping local data"
gunzip -c $SOLARIS_FILE.gz > $SOLARIS_FILE
fi
done
check_for_solaris_file $PICON_FILE 'XaSb85EpGNYqkEw' "gz"
check_for_solaris_file $MONTH_FILE 'n7cacmRBjk5Gb8f' "gz"
check_for_solaris_file $DAILY_FILE 'nJFTPcnFwZ3smTo' "gz"
check_for_solaris_file $FUTURE_MONFILE 'QWorEALDriYabgN' ""
check_for_solaris_file $FUTURE_DAYFILE 'j7ncYwoHXCtRwRE' ""
fi

echo 'Checking files are at vn4.6'
Expand All @@ -52,12 +71,22 @@ if [[ $PICON_VN != 'source_version = "4.6"' ]]; then
fi
MONTH_VN=`ncdump -h $MONTH_FILE | grep -o 'source_version = ".*"'`
if [[ $MONTH_VN != 'source_version = "4.6"' ]]; then
echo 'Monthly data is not at version 4.6: '$MONTH_VN
echo 'Monthly historical data is not at version 4.6: '$MONTH_VN
exit 1
fi
DAILY_VN=`ncdump -h $DAILY_FILE | grep -o 'source_version = ".*"'`
if [[ $DAILY_VN != 'source_version = "4.6"' ]]; then
echo 'Daily data is not at version 4.6: '$DAILY_VN
echo 'Daily historical data is not at version 4.6: '$DAILY_VN
exit 1
fi
FUTURE_MON_VN=`ncdump -h $FUTURE_MONFILE | grep -o 'source_version = ".*"'`
if [[ $FUTURE_MON_VN != 'source_version = "4.6"' ]]; then
echo 'Monthly future scenario data is not at version 4.6: '$FUTURE_MON_VN
exit 1
fi
FUTURE_DAY_VN=`ncdump -h $FUTURE_DAYFILE | grep -o 'source_version = ".*"'`
if [[ $FUTURE_DAY_VN != 'source_version = "4.6"' ]]; then
echo 'Daily future scenario data is not at version 4.6: '$FUTURE_DAY_VN
exit 1
fi

Expand All @@ -82,7 +111,7 @@ EOF
mv sp_sw_ga9_var sp_sw_ga9_cmip7_picontrol_4_6
rm $PICON_FILE

echo 'Adding monthly solar reference scenario data to spectral file'
echo 'Adding monthly solar reference & future scenario data to spectral file'
prep_spec << EOF > ref_mon.log
sp_sw_ga9
a
Expand All @@ -92,14 +121,18 @@ y
-2
6
$MONTH_FILE
3312
6
$FUTURE_MONFILE
2024 1 1
0
0
-1
EOF
mv sp_sw_ga9_var sp_sw_ga9_cmip7_ref_mon_4_6
mv sp_sw_ga9_var sp_sw_ga9_cmip7_scenario_mon_4_6
rm $MONTH_FILE

echo 'Adding daily solar reference scenario data to spectral file'
echo 'Adding daily solar reference & future scenario data to spectral file'
prep_spec << EOF > ref_day.log
sp_sw_ga9
a
Expand All @@ -109,11 +142,15 @@ y
-2
6
$DAILY_FILE
100807
6
$FUTURE_DAYFILE
2024 1 1
0
0
-1
EOF
mv sp_sw_ga9_var sp_sw_ga9_cmip7_ref_day_4_6
mv sp_sw_ga9_var sp_sw_ga9_cmip7_scenario_day_4_6
rm $DAILY_FILE

exit 0
18 changes: 9 additions & 9 deletions src/correlated_k/corr_k.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ PROGRAM corr_k
!
!
! Local scalars:
INTEGER :: start_time(8)
INTEGER :: start_time(8)
! Start/finish of program
INTEGER :: end_time(8)
INTEGER :: end_time(8)
! End of program
INTEGER :: iu_lbl
! Unit number for input of the LbL database in HITRAN format
Expand Down Expand Up @@ -369,7 +369,7 @@ END SUBROUTINE corr_k_single
CALL open_file_in(ierr, iu_lbl, &
"Give the name of the bespoke HITRAN .bpar database.")
IF (ierr /= i_normal) THEN
WRITE(iu_err, '(A, i5)') 'Error in open_file_in: ', ierr
WRITE(iu_err, '(A, i5)') 'Error in open_file_in: ', ierr
STOP
END IF
CALL read_parsum_dat
Expand Down Expand Up @@ -401,7 +401,7 @@ END SUBROUTINE corr_k_single
CALL open_file_in(ierr, iu_lbl, &
"Give the name of the .uvxsc database.")
IF (ierr /= i_normal) THEN
WRITE(iu_err, '(A, i5)') 'Error in open_file_in: ', ierr
WRITE(iu_err, '(A, i5)') 'Error in open_file_in: ', ierr
STOP
END IF
EXIT
Expand Down Expand Up @@ -480,12 +480,12 @@ END SUBROUTINE corr_k_single
include_instrument_response=.TRUE.
CALL read_instrument_response_90(filter, ierr)
IF (ierr /= i_normal) STOP
EXIT
EXIT Inst
!
ELSE IF ( (char_if == 'N') .OR. (char_if == 'n') ) THEN
!
include_instrument_response=.FALSE.
EXIT
EXIT Inst
!
ELSE
!
Expand Down Expand Up @@ -529,7 +529,7 @@ END SUBROUTINE corr_k_single
i_line_prof_corr, l_self_broadening, n_gas_frac, gas_frac, npd_gas_frac, &
ierr)
!
! Allocate arrays for the k-fit, now that the size of the scaling
! Allocate arrays for the k-fit, now that the size of the scaling
! vector is known.
ALLOCATE(w_k(npd_k_term, Spectrum%Dim%nd_band))
ALLOCATE(k_opt(npd_k_term, Spectrum%Dim%nd_band))
Expand All @@ -545,7 +545,7 @@ END SUBROUTINE corr_k_single
l_fit_self_continuum .OR. l_fit_frn_continuum) THEN
! Select the weighting to be applied.
CALL select_weight_ck_90(i_weight, SolarSpec, l_interactive, ierr)
!
!
! Set the output file.
CALL get_free_unit(ierr, iu_k_out)
IF (ierr /= i_normal) STOP
Expand All @@ -554,7 +554,7 @@ END SUBROUTINE corr_k_single
file_k, ierr)
IF (ierr /= i_normal) STOP
END IF

! Define the output file of detailed monitoring information.
CALL get_free_unit(ierr, iu_monitor)
IF (ierr /= i_normal) STOP
Expand Down
Loading