--- trunk/libf/phylmd/phyetat0.f90 2011/08/24 11:43:14 49 +++ trunk/Sources/phylmd/phyetat0.f 2015/06/05 18:58:06 140 @@ -4,47 +4,50 @@ IMPLICIT none - REAL, save:: rlat(klon), rlon(klon) ! latitude and longitude, in degrees + REAL, save:: rlat(klon), rlon(klon) + ! latitude and longitude of a point of the scalar grid identified + ! by a simple index, in degrees private klon contains - SUBROUTINE phyetat0(fichnom, pctsrf, tsol, tsoil, ocean, tslab, seaice, & - qsurf, qsol, snow, albe, alblw, evap, rain_fall, snow_fall, solsw, & - sollw, fder, radsol, frugs, agesno, zmea, zstd, zsig, zgam, zthe, & - zpic, zval, t_ancien, q_ancien, ancien_ok, rnebcon, ratqs, clwcon, & - run_off_lic_0) + SUBROUTINE phyetat0(pctsrf, tsol, tsoil, tslab, seaice, qsurf, qsol, & + snow, albe, alblw, evap, rain_fall, snow_fall, solsw, sollw, fder, & + radsol, frugs, agesno, zmea, zstd, zsig, zgam, zthe, zpic, zval, & + t_ancien, q_ancien, ancien_ok, rnebcon, ratqs, clwcon, run_off_lic_0, & + sig1, w01) ! From phylmd/phyetat0.F, version 1.4 2005/06/03 10:03:07 ! Author: Z.X. Li (LMD/CNRS) - ! Date: 19930818 - ! Objet : Lecture de l'état initial pour la physique + ! Date: 1993/08/18 + ! Objet : lecture de l'état initial pour la physique - USE indicesol, ONLY : epsfra, is_lic, is_oce, is_sic, is_ter, nbsrf + use dimphy, only: zmasq, klev USE dimsoil, ONLY : nsoilmx + USE indicesol, ONLY : epsfra, is_lic, is_oce, is_sic, is_ter, nbsrf + use netcdf, only: nf90_global, nf90_inq_varid, NF90_NOERR, & + NF90_NOWRITE + use netcdf95, only: nf95_close, nf95_get_att, nf95_get_var, & + nf95_inq_varid, nf95_inquire_variable, NF95_OPEN USE temps, ONLY : itau_phy - use netcdf, only: nf90_get_att, nf90_global, nf90_inq_varid, NF90_NOERR, & - nf90_get_var, NF90_NOWRITE - use netcdf95, only: handle_err, nf95_get_var, nf95_close, NF95_OPEN - use dimphy, only: zmasq, klev - CHARACTER(len=*), intent(in):: fichnom + REAL pctsrf(klon, nbsrf) REAL tsol(klon, nbsrf) REAL tsoil(klon, nsoilmx, nbsrf) REAL tslab(klon), seaice(klon) REAL qsurf(klon, nbsrf) - REAL qsol(klon) + REAL, intent(out):: qsol(:) ! (klon) REAL snow(klon, nbsrf) REAL albe(klon, nbsrf) REAL alblw(klon, nbsrf) REAL evap(klon, nbsrf) - REAL radsol(klon) - REAL rain_fall(klon) + REAL, intent(out):: rain_fall(klon) REAL snow_fall(klon) - REAL sollw(klon) real solsw(klon) + REAL, intent(out):: sollw(klon) real fder(klon) + REAL radsol(klon) REAL frugs(klon, nbsrf) REAL agesno(klon, nbsrf) REAL zmea(klon) @@ -54,70 +57,46 @@ REAL zthe(klon) REAL zpic(klon) REAL zval(klon) - REAL pctsrf(klon, nbsrf) - REAL fractint(klon) - REAL run_off_lic_0(klon) - REAL t_ancien(klon, klev), q_ancien(klon, klev) - real rnebcon(klon, klev), clwcon(klon, klev), ratqs(klon, klev) LOGICAL, intent(out):: ancien_ok + real rnebcon(klon, klev), ratqs(klon, klev), clwcon(klon, klev) + REAL run_off_lic_0(klon) + real, intent(out):: sig1(klon, klev) ! section adiabatic updraft - CHARACTER(len=*), intent(in):: ocean + real, intent(out):: w01(klon, klev) + ! vertical velocity within adiabatic updraft + ! Local: + REAL fractint(klon) REAL xmin, xmax - - INTEGER ncid, varid - INTEGER ierr, i, nsrf, isoil - CHARACTER*7 str7 - CHARACTER*2 str2 + INTEGER ncid, varid, ndims + INTEGER ierr, i, nsrf + CHARACTER(len=2) str2 !--------------------------------------------------------------- print *, "Call sequence information: phyetat0" - ! Ouvrir le fichier contenant l'etat initial: - print *, 'fichnom = ', fichnom - call NF95_OPEN(fichnom, NF90_NOWRITE, ncid) + ! Fichier contenant l'état initial : + call NF95_OPEN("startphy.nc", NF90_NOWRITE, ncid) - ierr = nf90_get_att(ncid, nf90_global, "itau_phy", itau_phy) - call handle_err("phyetat0 itau_phy", ierr, ncid, nf90_global) + call nf95_get_att(ncid, nf90_global, "itau_phy", itau_phy) ! Lecture des latitudes (coordonnees): - ierr = NF90_INQ_VARID(ncid, "latitude", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Le champ est absent' - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, rlat) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Lecture echouee pour ' - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "latitude", varid) + call NF95_GET_VAR(ncid, varid, rlat) ! Lecture des longitudes (coordonnees): - ierr = NF90_INQ_VARID(ncid, "longitude", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Le champ est absent' - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, rlon) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Lecture echouee pour ' - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "longitude", varid) + call NF95_GET_VAR(ncid, varid, rlon) ! Lecture du masque terre mer - ierr = NF90_INQ_VARID(ncid, "masque", varid) - IF (ierr == NF90_NOERR) THEN - call nf95_get_var(ncid, varid, zmasq) - else - PRINT *, 'phyetat0: Le champ est absent' - PRINT *, 'fichier startphy non compatible avec phyetat0' - ! stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "masque", varid) + call nf95_get_var(ncid, varid, zmasq) + ! Lecture des fractions pour chaque sous-surface ! initialisation des sous-surfaces @@ -127,199 +106,93 @@ ! fraction de terre ierr = NF90_INQ_VARID(ncid, "FTER", varid) - IF (ierr == NF90_NOERR) THEN - call nf95_get_var(ncid, varid, pctsrf(1 : klon, is_ter)) + IF (ierr == NF90_NOERR) THEN + call nf95_get_var(ncid, varid, pctsrf(:, is_ter)) else PRINT *, 'phyetat0: Le champ est absent' - !$$$ stop 1 ENDIF ! fraction de glace de terre ierr = NF90_INQ_VARID(ncid, "FLIC", varid) - IF (ierr == NF90_NOERR) THEN - call nf95_get_var(ncid, varid, pctsrf(1 : klon, is_lic)) + IF (ierr == NF90_NOERR) THEN + call nf95_get_var(ncid, varid, pctsrf(:, is_lic)) else PRINT *, 'phyetat0: Le champ est absent' - !$$$ stop 1 ENDIF ! fraction d'ocean ierr = NF90_INQ_VARID(ncid, "FOCE", varid) - IF (ierr == NF90_NOERR) THEN - call nf95_get_var(ncid, varid, pctsrf(1 : klon, is_oce)) + IF (ierr == NF90_NOERR) THEN + call nf95_get_var(ncid, varid, pctsrf(:, is_oce)) else PRINT *, 'phyetat0: Le champ est absent' - !$$$ stop 1 ENDIF ! fraction glace de mer ierr = NF90_INQ_VARID(ncid, "FSIC", varid) - IF (ierr == NF90_NOERR) THEN - call nf95_get_var(ncid, varid, pctsrf(1 : klon, is_sic)) + IF (ierr == NF90_NOERR) THEN + call nf95_get_var(ncid, varid, pctsrf(:, is_sic)) else PRINT *, 'phyetat0: Le champ est absent' - !$$$ stop 1 ENDIF - ! Verification de l'adequation entre le masque et les sous-surfaces + ! Verification de l'adequation entre le masque et les sous-surfaces - fractint( 1 : klon) = pctsrf(1 : klon, is_ter) & - + pctsrf(1 : klon, is_lic) + fractint = pctsrf(:, is_ter) + pctsrf(:, is_lic) DO i = 1 , klon - IF ( abs(fractint(i) - zmasq(i) ) .GT. EPSFRA ) THEN - WRITE(*, *) 'phyetat0: attention fraction terre pas ', & + IF ( abs(fractint(i) - zmasq(i) ) > EPSFRA ) THEN + WRITE(*, *) 'phyetat0: attention fraction terre pas ', & 'coherente ', i, zmasq(i), pctsrf(i, is_ter) & , pctsrf(i, is_lic) ENDIF END DO - fractint(1 : klon) = pctsrf(1 : klon, is_oce) & - + pctsrf(1 : klon, is_sic) + fractint = pctsrf(:, is_oce) + pctsrf(:, is_sic) DO i = 1 , klon - IF ( abs( fractint(i) - (1. - zmasq(i))) .GT. EPSFRA ) THEN - WRITE(*, *) 'phyetat0 attention fraction ocean pas ', & + IF ( abs( fractint(i) - (1. - zmasq(i))) > EPSFRA ) THEN + WRITE(*, *) 'phyetat0 attention fraction ocean pas ', & 'coherente ', i, zmasq(i) , pctsrf(i, is_oce) & , pctsrf(i, is_sic) ENDIF END DO ! Lecture des temperatures du sol: - - ierr = NF90_INQ_VARID(ncid, "TS", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0 : Le champ est absent' - PRINT *, ' Mais je vais essayer de lire TS**' - DO nsrf = 1, nbsrf - IF (nsrf.GT.99) THEN - PRINT *, "Trop de sous-mailles" - stop 1 - ENDIF - WRITE(str2, '(i2.2)') nsrf - ierr = NF90_INQ_VARID(ncid, "TS"//str2, varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Le champ est absent" - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, tsol(1, nsrf)) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Lecture echouee pour " - stop 1 - ENDIF - xmin = 1.0E+20 - xmax = -1.0E+20 - DO i = 1, klon - xmin = MIN(tsol(i, nsrf), xmin) - xmax = MAX(tsol(i, nsrf), xmax) - ENDDO - PRINT *, 'Temperature du sol TS**:', nsrf, xmin, xmax - ENDDO - ELSE - PRINT *, 'phyetat0: Le champ est present' - PRINT *, ' J ignore donc les autres temperatures TS**' + call NF95_INQ_VARID(ncid, "TS", varid) + call nf95_inquire_variable(ncid, varid, ndims = ndims) + if (ndims == 2) then + call NF95_GET_VAR(ncid, varid, tsol) + else + print *, "Found only one surface type for soil temperature." call nf95_get_var(ncid, varid, tsol(:, 1)) - xmin = 1.0E+20 - xmax = -1.0E+20 - DO i = 1, klon - xmin = MIN(tsol(i, 1), xmin) - xmax = MAX(tsol(i, 1), xmax) - ENDDO - PRINT *, 'Temperature du sol ', xmin, xmax - DO nsrf = 2, nbsrf - DO i = 1, klon - tsol(i, nsrf) = tsol(i, 1) - ENDDO - ENDDO - ENDIF + tsol(:, 2:nbsrf) = spread(tsol(:, 1), dim = 2, ncopies = nbsrf - 1) + end if - ! Lecture des temperatures du sol profond: + ! Lecture des temperatures du sol profond: - DO nsrf = 1, nbsrf - DO isoil=1, nsoilmx - IF (isoil.GT.99 .AND. nsrf.GT.99) THEN - PRINT *, "Trop de couches ou sous-mailles" - stop 1 - ENDIF - WRITE(str7, '(i2.2, "srf", i2.2)') isoil, nsrf - ierr = NF90_INQ_VARID(ncid, 'Tsoil'//str7, varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Le champ est absent" - PRINT *, " Il prend donc la valeur de surface" - DO i=1, klon - tsoil(i, isoil, nsrf)=tsol(i, nsrf) - ENDDO - ELSE - ierr = NF90_GET_VAR(ncid, varid, tsoil(1, isoil, nsrf)) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "Lecture echouee pour " - stop 1 - ENDIF - ENDIF - ENDDO - ENDDO + call NF95_INQ_VARID(ncid, 'Tsoil', varid) + call NF95_GET_VAR(ncid, varid, tsoil) !IM "slab" ocean - - ! Lecture de tslab (pour slab ocean seulement): - - IF (ocean .eq. 'slab ') then - ierr = NF90_INQ_VARID(ncid, "TSLAB", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Le champ est absent" - stop 1 - ENDIF - call nf95_get_var(ncid, varid, tslab) - xmin = 1.0E+20 - xmax = -1.0E+20 - DO i = 1, klon - xmin = MIN(tslab(i), xmin) - xmax = MAX(tslab(i), xmax) - ENDDO - PRINT *, 'Ecart de la SST tslab:', xmin, xmax - - ! Lecture de seaice (pour slab ocean seulement): - - ierr = NF90_INQ_VARID(ncid, "SEAICE", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Le champ est absent" - stop 1 - ENDIF - call nf95_get_var(ncid, varid, seaice) - xmin = 1.0E+20 - xmax = -1.0E+20 - DO i = 1, klon - xmin = MIN(seaice(i), xmin) - xmax = MAX(seaice(i), xmax) - ENDDO - PRINT *, 'Masse de la glace de mer seaice:', xmin, xmax - ELSE - tslab = 0. - seaice = 0. - ENDIF + ! Lecture de tslab (pour slab ocean seulement): + tslab = 0. + seaice = 0. ! Lecture de l'humidite de l'air juste au dessus du sol: ierr = NF90_INQ_VARID(ncid, "QS", varid) IF (ierr /= NF90_NOERR) THEN PRINT *, 'phyetat0: Le champ est absent' - PRINT *, ' Mais je vais essayer de lire QS**' + PRINT *, ' Mais je vais essayer de lire QS**' DO nsrf = 1, nbsrf - IF (nsrf.GT.99) THEN + IF (nsrf > 99) THEN PRINT *, "Trop de sous-mailles" stop 1 ENDIF WRITE(str2, '(i2.2)') nsrf - ierr = NF90_INQ_VARID(ncid, "QS"//str2, varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Le champ est absent" - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, qsurf(1, nsrf)) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Lecture echouee pour " - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "QS"//str2, varid) + call NF95_GET_VAR(ncid, varid, qsurf(:, nsrf)) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -330,7 +203,7 @@ ENDDO ELSE PRINT *, 'phyetat0: Le champ est present' - PRINT *, ' J ignore donc les autres humidites QS**' + PRINT *, ' J ignore donc les autres humidites QS**' call nf95_get_var(ncid, varid, qsurf(:, 1)) xmin = 1.0E+20 xmax = -1.0E+20 @@ -349,43 +222,28 @@ ! Eau dans le sol (pour le modele de sol "bucket") ierr = NF90_INQ_VARID(ncid, "QSOL", varid) - IF (ierr == NF90_NOERR) THEN + IF (ierr == NF90_NOERR) THEN call nf95_get_var(ncid, varid, qsol) else PRINT *, 'phyetat0: Le champ est absent' - PRINT *, ' Valeur par defaut nulle' + PRINT *, ' Valeur par defaut nulle' qsol = 0. ENDIF - xmin = 1.0E+20 - xmax = -1.0E+20 - DO i = 1, klon - xmin = MIN(qsol(i), xmin) - xmax = MAX(qsol(i), xmax) - ENDDO - PRINT *, 'Eau dans le sol (mm) ', xmin, xmax ! Lecture de neige au sol: ierr = NF90_INQ_VARID(ncid, "SNOW", varid) IF (ierr /= NF90_NOERR) THEN PRINT *, 'phyetat0: Le champ est absent' - PRINT *, ' Mais je vais essayer de lire SNOW**' + PRINT *, ' Mais je vais essayer de lire SNOW**' DO nsrf = 1, nbsrf - IF (nsrf.GT.99) THEN + IF (nsrf > 99) THEN PRINT *, "Trop de sous-mailles" stop 1 ENDIF WRITE(str2, '(i2.2)') nsrf - ierr = NF90_INQ_VARID(ncid, "SNOW"//str2, varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Le champ est absent" - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, snow(1, nsrf)) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Lecture echouee pour " - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "SNOW"//str2, varid) + call NF95_GET_VAR(ncid, varid, snow(:, nsrf)) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -396,7 +254,7 @@ ENDDO ELSE PRINT *, 'phyetat0: Le champ est present' - PRINT *, ' J ignore donc les autres neiges SNOW**' + PRINT *, ' J ignore donc les autres neiges SNOW**' call nf95_get_var(ncid, varid, snow(:, 1)) xmin = 1.0E+20 xmax = -1.0E+20 @@ -417,23 +275,15 @@ ierr = NF90_INQ_VARID(ncid, "ALBE", varid) IF (ierr /= NF90_NOERR) THEN PRINT *, 'phyetat0: Le champ est absent' - PRINT *, ' Mais je vais essayer de lire ALBE**' + PRINT *, ' Mais je vais essayer de lire ALBE**' DO nsrf = 1, nbsrf - IF (nsrf.GT.99) THEN + IF (nsrf > 99) THEN PRINT *, "Trop de sous-mailles" stop 1 ENDIF WRITE(str2, '(i2.2)') nsrf - ierr = NF90_INQ_VARID(ncid, "ALBE"//str2, varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Le champ est absent" - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, albe(1, nsrf)) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Lecture echouee pour " - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "ALBE"//str2, varid) + call NF95_GET_VAR(ncid, varid, albe(:, nsrf)) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -444,7 +294,7 @@ ENDDO ELSE PRINT *, 'phyetat0: Le champ est present' - PRINT *, ' J ignore donc les autres ALBE**' + PRINT *, ' J ignore donc les autres ALBE**' call nf95_get_var(ncid, varid, albe(:, 1)) xmin = 1.0E+20 xmax = -1.0E+20 @@ -465,8 +315,8 @@ ierr = NF90_INQ_VARID(ncid, "ALBLW", varid) IF (ierr /= NF90_NOERR) THEN PRINT *, 'phyetat0: Le champ est absent' - ! PRINT *, ' Mais je vais essayer de lire ALBLW**' - PRINT *, ' Mais je vais prendre ALBE**' + ! PRINT *, ' Mais je vais essayer de lire ALBLW**' + PRINT *, ' Mais je vais prendre ALBE**' DO nsrf = 1, nbsrf DO i = 1, klon alblw(i, nsrf) = albe(i, nsrf) @@ -474,7 +324,7 @@ ENDDO ELSE PRINT *, 'phyetat0: Le champ est present' - PRINT *, ' J ignore donc les autres ALBLW**' + PRINT *, ' J ignore donc les autres ALBLW**' call nf95_get_var(ncid, varid, alblw(:, 1)) xmin = 1.0E+20 xmax = -1.0E+20 @@ -490,28 +340,20 @@ ENDDO ENDIF - ! Lecture de evaporation: + ! Lecture de evaporation: ierr = NF90_INQ_VARID(ncid, "EVAP", varid) IF (ierr /= NF90_NOERR) THEN PRINT *, 'phyetat0: Le champ est absent' - PRINT *, ' Mais je vais essayer de lire EVAP**' + PRINT *, ' Mais je vais essayer de lire EVAP**' DO nsrf = 1, nbsrf - IF (nsrf.GT.99) THEN + IF (nsrf > 99) THEN PRINT *, "Trop de sous-mailles" stop 1 ENDIF WRITE(str2, '(i2.2)') nsrf - ierr = NF90_INQ_VARID(ncid, "EVAP"//str2, varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Le champ est absent" - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, evap(1, nsrf)) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Lecture echouee pour " - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "EVAP"//str2, varid) + call NF95_GET_VAR(ncid, varid, evap(:, nsrf)) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -522,7 +364,7 @@ ENDDO ELSE PRINT *, 'phyetat0: Le champ est present' - PRINT *, ' J ignore donc les autres EVAP**' + PRINT *, ' J ignore donc les autres EVAP**' call nf95_get_var(ncid, varid, evap(:, 1)) xmin = 1.0E+20 xmax = -1.0E+20 @@ -540,36 +382,13 @@ ! Lecture precipitation liquide: - ierr = NF90_INQ_VARID(ncid, "rain_f", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Le champ est absent' - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, rain_fall) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Lecture echouee pour ' - stop 1 - ENDIF - xmin = 1.0E+20 - xmax = -1.0E+20 - DO i = 1, klon - xmin = MIN(rain_fall(i), xmin) - xmax = MAX(rain_fall(i), xmax) - ENDDO - PRINT *, 'Precipitation liquide rain_f:', xmin, xmax + call NF95_INQ_VARID(ncid, "rain_f", varid) + call NF95_GET_VAR(ncid, varid, rain_fall) ! Lecture precipitation solide: - ierr = NF90_INQ_VARID(ncid, "snow_f", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Le champ est absent' - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, snow_fall) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Lecture echouee pour ' - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "snow_f", varid) + call NF95_GET_VAR(ncid, varid, snow_fall) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -606,13 +425,7 @@ ELSE call nf95_get_var(ncid, varid, sollw) ENDIF - xmin = 1.0E+20 - xmax = -1.0E+20 - DO i = 1, klon - xmin = MIN(sollw(i), xmin) - xmax = MAX(sollw(i), xmax) - ENDDO - PRINT *, 'Rayonnement IF au sol sollw:', xmin, xmax + PRINT *, 'Rayonnement IF au sol sollw:', minval(sollw), maxval(sollw) ! Lecture derive des flux: @@ -634,16 +447,8 @@ ! Lecture du rayonnement net au sol: - ierr = NF90_INQ_VARID(ncid, "RADS", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Le champ est absent' - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, radsol) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Lecture echouee pour ' - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "RADS", varid) + call NF95_GET_VAR(ncid, varid, radsol) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -657,23 +462,15 @@ ierr = NF90_INQ_VARID(ncid, "RUG", varid) IF (ierr /= NF90_NOERR) THEN PRINT *, 'phyetat0: Le champ est absent' - PRINT *, ' Mais je vais essayer de lire RUG**' + PRINT *, ' Mais je vais essayer de lire RUG**' DO nsrf = 1, nbsrf - IF (nsrf.GT.99) THEN + IF (nsrf > 99) THEN PRINT *, "Trop de sous-mailles" stop 1 ENDIF WRITE(str2, '(i2.2)') nsrf - ierr = NF90_INQ_VARID(ncid, "RUG"//str2, varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Le champ est absent" - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, frugs(1, nsrf)) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Lecture echouee pour " - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "RUG"//str2, varid) + call NF95_GET_VAR(ncid, varid, frugs(:, nsrf)) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -684,7 +481,7 @@ ENDDO ELSE PRINT *, 'phyetat0: Le champ est present' - PRINT *, ' J ignore donc les autres RUG**' + PRINT *, ' J ignore donc les autres RUG**' call nf95_get_var(ncid, varid, frugs(:, 1)) xmin = 1.0E+20 xmax = -1.0E+20 @@ -705,9 +502,9 @@ ierr = NF90_INQ_VARID(ncid, "AGESNO", varid) IF (ierr /= NF90_NOERR) THEN PRINT *, 'phyetat0: Le champ est absent' - PRINT *, ' Mais je vais essayer de lire AGESNO**' + PRINT *, ' Mais je vais essayer de lire AGESNO**' DO nsrf = 1, nbsrf - IF (nsrf.GT.99) THEN + IF (nsrf > 99) THEN PRINT *, "Trop de sous-mailles" stop 1 ENDIF @@ -717,11 +514,7 @@ PRINT *, "phyetat0: Le champ est absent" agesno = 50.0 ENDIF - ierr = NF90_GET_VAR(ncid, varid, agesno(1, nsrf)) - IF (ierr /= NF90_NOERR) THEN - PRINT *, "phyetat0: Lecture echouee pour " - stop 1 - ENDIF + call NF95_GET_VAR(ncid, varid, agesno(:, nsrf)) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -732,7 +525,7 @@ ENDDO ELSE PRINT *, 'phyetat0: Le champ est present' - PRINT *, ' J ignore donc les autres AGESNO**' + PRINT *, ' J ignore donc les autres AGESNO**' call nf95_get_var(ncid, varid, agesno(:, 1)) xmin = 1.0E+20 xmax = -1.0E+20 @@ -748,16 +541,8 @@ ENDDO ENDIF - ierr = NF90_INQ_VARID(ncid, "ZMEA", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Le champ est absent' - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, zmea) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Lecture echouee pour ' - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "ZMEA", varid) + call NF95_GET_VAR(ncid, varid, zmea) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -766,16 +551,8 @@ ENDDO PRINT *, 'OROGRAPHIE SOUS-MAILLE zmea:', xmin, xmax - ierr = NF90_INQ_VARID(ncid, "ZSTD", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Le champ est absent' - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, zstd) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Lecture echouee pour ' - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "ZSTD", varid) + call NF95_GET_VAR(ncid, varid, zstd) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -784,16 +561,8 @@ ENDDO PRINT *, 'OROGRAPHIE SOUS-MAILLE zstd:', xmin, xmax - ierr = NF90_INQ_VARID(ncid, "ZSIG", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Le champ est absent' - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, zsig) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Lecture echouee pour ' - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "ZSIG", varid) + call NF95_GET_VAR(ncid, varid, zsig) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -802,16 +571,8 @@ ENDDO PRINT *, 'OROGRAPHIE SOUS-MAILLE zsig:', xmin, xmax - ierr = NF90_INQ_VARID(ncid, "ZGAM", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Le champ est absent' - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, zgam) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Lecture echouee pour ' - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "ZGAM", varid) + call NF95_GET_VAR(ncid, varid, zgam) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -820,16 +581,8 @@ ENDDO PRINT *, 'OROGRAPHIE SOUS-MAILLE zgam:', xmin, xmax - ierr = NF90_INQ_VARID(ncid, "ZTHE", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Le champ est absent' - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, zthe) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Lecture echouee pour ' - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "ZTHE", varid) + call NF95_GET_VAR(ncid, varid, zthe) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -838,16 +591,8 @@ ENDDO PRINT *, 'OROGRAPHIE SOUS-MAILLE zthe:', xmin, xmax - ierr = NF90_INQ_VARID(ncid, "ZPIC", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Le champ est absent' - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, zpic) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Lecture echouee pour ' - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "ZPIC", varid) + call NF95_GET_VAR(ncid, varid, zpic) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -856,16 +601,8 @@ ENDDO PRINT *, 'OROGRAPHIE SOUS-MAILLE zpic:', xmin, xmax - ierr = NF90_INQ_VARID(ncid, "ZVAL", varid) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Le champ est absent' - stop 1 - ENDIF - ierr = NF90_GET_VAR(ncid, varid, zval) - IF (ierr /= NF90_NOERR) THEN - PRINT *, 'phyetat0: Lecture echouee pour ' - stop 1 - ENDIF + call NF95_INQ_VARID(ncid, "ZVAL", varid) + call NF95_GET_VAR(ncid, varid, zval) xmin = 1.0E+20 xmax = -1.0E+20 DO i = 1, klon @@ -900,7 +637,8 @@ PRINT *, "Depart legerement fausse. Mais je continue" clwcon = 0. ELSE - call nf95_get_var(ncid, varid, clwcon) + call nf95_get_var(ncid, varid, clwcon(:, 1)) + clwcon(:, 2:) = 0. ENDIF xmin = 1.0E+20 xmax = -1.0E+20 @@ -914,7 +652,8 @@ PRINT *, "Depart legerement fausse. Mais je continue" rnebcon = 0. ELSE - call nf95_get_var(ncid, varid, rnebcon) + call nf95_get_var(ncid, varid, rnebcon(:, 1)) + rnebcon(:, 2:) = 0. ENDIF xmin = 1.0E+20 xmax = -1.0E+20 @@ -930,7 +669,8 @@ PRINT *, "Depart legerement fausse. Mais je continue" ratqs = 0. ELSE - call nf95_get_var(ncid, varid, ratqs) + call nf95_get_var(ncid, varid, ratqs(:, 1)) + ratqs(:, 2:) = 0. ENDIF xmin = 1.0E+20 xmax = -1.0E+20 @@ -954,6 +694,12 @@ xmax = MAXval(run_off_lic_0) PRINT *, '(ecart-type) run_off_lic_0:', xmin, xmax + call nf95_inq_varid(ncid, "sig1", varid) + call nf95_get_var(ncid, varid, sig1) + + call nf95_inq_varid(ncid, "w01", varid) + call nf95_get_var(ncid, varid, w01) + call NF95_CLOSE(ncid) END SUBROUTINE phyetat0