From 34e7ebd686d00f323509a51a14f1f9d20a3315e0 Mon Sep 17 00:00:00 2001 From: IngoBethke Date: Mon, 4 Sep 2017 14:03:14 +0200 Subject: [PATCH] Skip component if it has no input files. --- source/m_modelsatm.F | 12 +++++++++++- source/m_modelsice.F | 40 +++++++++++++++++++++++++++++++--------- source/m_modelslnd.F | 2 ++ source/m_modelsocn.F | 2 ++ 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/source/m_modelsatm.F b/source/m_modelsatm.F index 03294958..17ebf4a7 100644 --- a/source/m_modelsatm.F +++ b/source/m_modelsatm.F @@ -73,6 +73,8 @@ SUBROUTINE atm2cmor c c --- Read grid information from input files itag=tagamon + CALL scan_files(reset=.TRUE.) + IF (LEN_TRIM(fnm).EQ.0) RETURN CALL read_gridinfo_ifile c c --- Initialise pressure level dimension @@ -783,7 +785,11 @@ SUBROUTINE special_pre c --- - Set N_AER units CASE ('cm-3') vunits='cm-3' -c +c +c --- - Convert degress Celsius to K + CASE ('Celsius2Kelvin') + vunits='K' +c c --- - Convert units from radians2 to m2 CASE ('rad2m') vunits='m2' @@ -847,6 +853,10 @@ SUBROUTINE special_post ENDIF SELECT CASE (str1) c +c --- - Convert degress Celsius to K + CASE ('Celsius2Kelvin') + ofld=ofld+273.15 +c c --- - CO2 units CASE ('co2units') ofld=ofld*1e6*29./(12.+2.*16.) diff --git a/source/m_modelsice.F b/source/m_modelsice.F index f00d61d4..7d998348 100644 --- a/source/m_modelsice.F +++ b/source/m_modelsice.F @@ -81,6 +81,8 @@ SUBROUTINE ice2cmor c --- Read grid information from input files WRITE(*,*) 'Read grid information from input files' itag=tagimon + CALL scan_files(reset=.TRUE.) + IF (LEN_TRIM(fnm).EQ.0) RETURN CALL read_gridinfo_ifile c c --- Read Fram Strait grid information from secindex.dat @@ -426,6 +428,10 @@ SUBROUTINE special_pre c --- - Fix micrometers units CASE ('micrometer') vunits='micrometers' +c +c --- - Convert degC to K + CASE ('Celsius2Kelvin') + vunits='K' c c --- - Fix m-2 units CASE ('m-2') @@ -487,6 +493,10 @@ SUBROUTINE special_post c --- - Convert units from radians2 to m2 CASE ('rad2m') fld=fld*6.37122e6**2 +c +c --- - Convert degC to K + CASE ('Celsius2Kelvin') + fld=fld+273.15 c c --- - Unit transformation: cm day-1 -> kg m-2 s-1 CASE ('cmFW day-1 -> kg m-2 s-1') @@ -597,17 +607,29 @@ SUBROUTINE read_gridinfo_ifile status=nf90_get_var(ncid,rhid,uvlat) CALL handle_ncerror(status) status=nf90_inq_varid(ncid,'ANGLE',rhid) - CALL handle_ncerror(status) - status=nf90_get_var(ncid,rhid,angle) - CALL handle_ncerror(status) + IF (status.EQ.NF90_NOERR) THEN + status=nf90_get_var(ncid,rhid,angle) + CALL handle_ncerror(status) + ELSE + WRITE(*,*) 'ANGLE not in sea ice file. Setting to zero.' + angle=0 + ENDIF status=nf90_inq_varid(ncid,'tarea',rhid) - CALL handle_ncerror(status) - status=nf90_get_var(ncid,rhid,tarea) - CALL handle_ncerror(status) + IF (status.EQ.NF90_NOERR) THEN + status=nf90_get_var(ncid,rhid,tarea) + CALL handle_ncerror(status) + ELSE + WRITE(*,*) 'tarea not in sea ice file. Setting to one.' + tarea=1 + ENDIF status=nf90_inq_varid(ncid,'uarea',rhid) - CALL handle_ncerror(status) - status=nf90_get_var(ncid,rhid,uarea) - CALL handle_ncerror(status) + IF (status.EQ.NF90_NOERR) THEN + status=nf90_get_var(ncid,rhid,uarea) + CALL handle_ncerror(status) + ELSE + WRITE(*,*) 'uarea not in sea ice file. Setting to one.' + uarea=1 + ENDIF c c --- Read calendar info (override/change units) status=nf90_inq_varid(ncid,'time',rhid) diff --git a/source/m_modelslnd.F b/source/m_modelslnd.F index 83501adc..2d99204a 100644 --- a/source/m_modelslnd.F +++ b/source/m_modelslnd.F @@ -61,6 +61,8 @@ SUBROUTINE lnd2cmor c --- Read grid information from input files WRITE(*,*) 'Read grid information from input files' itag=taglmon + CALL scan_files(reset=.TRUE.) + IF (LEN_TRIM(fnm).EQ.0) RETURN CALL read_gridinfo_ifile c c --- Process table fx diff --git a/source/m_modelsocn.F b/source/m_modelsocn.F index 5d5568fd..c905534f 100644 --- a/source/m_modelsocn.F +++ b/source/m_modelsocn.F @@ -86,6 +86,8 @@ SUBROUTINE ocn2cmor c --- Read grid information from input files WRITE(*,*) 'Read grid information from input files' itag=tagomon + CALL scan_files(reset=.TRUE.) + IF (LEN_TRIM(fnm).EQ.0) RETURN CALL read_gridinfo_ifile c c --- Process table fx