--- trunk/libf/dyn3d/limit.f90 2008/07/25 19:59:34 13 +++ trunk/libf/dyn3d/limit.f90 2009/07/31 15:18:47 22 @@ -21,13 +21,13 @@ use conf_gcm_m, only: day_step use comgeom, only: rlonu, rlatv use etat0_mod, only: pctsrf - use start_init_orog_m, only: masque + use start_init_orog_m, only: mask use conf_dat2d_m, only: conf_dat2d use inter_barxy_m, only: inter_barxy use numer_rec, only: spline, splint use grid_change, only: dyn_phy - use netcdf95, only: handle_err, nf95_get_coord, NF95_CLOSE, NF95_DEF_DIM, & + use netcdf95, only: handle_err, nf95_gw_var, NF95_CLOSE, NF95_DEF_DIM, & nf95_enddef, NF95_CREATE, nf95_inq_dimid, nf95_inquire_dimension, & nf95_inq_varid, NF95_OPEN use netcdf, only: NF90_CLOBBER, nf90_def_var, NF90_FLOAT, NF90_GET_VAR, & @@ -95,20 +95,26 @@ PRINT *, 'Processing rugosity...' call NF95_OPEN('Rugos.nc', NF90_NOWRITE, ncid) - call nf95_get_coord(ncid, "longitude", dlon_ini) + ! Read coordinate variables: + + call nf95_inq_varid(ncid, "longitude", varid) + call nf95_gw_var(ncid, varid, dlon_ini) imdep = size(dlon_ini) - call nf95_get_coord(ncid, "latitude", dlat_ini) + call nf95_inq_varid(ncid, "latitude", varid) + call nf95_gw_var(ncid, varid, dlat_ini) jmdep = size(dlat_ini) - call nf95_get_coord(ncid, "temps", timeyear) + call nf95_inq_varid(ncid, "temps", varid) + call nf95_gw_var(ncid, varid, timeyear) lmdep = size(timeyear) ALLOCATE(champ(imdep, jmdep), champtime(iim, jjm + 1, lmdep)) allocate(dlon(imdep), dlat(jmdep)) call NF95_INQ_VARID(ncid, 'RUGOS', varid) - ! Compute "champtime": + ! Read the primary variable day by day and regrid horizontally, + ! result in "champtime": DO l = 1, lmdep ierr = NF90_GET_VAR(ncid, varid, champ, start=(/1, 1, l/)) call handle_err("NF90_GET_VAR", ierr) @@ -117,7 +123,7 @@ CALL inter_barxy(dlon, dlat(:jmdep -1), LOG(champ), rlonu(:iim), & rlatv, champtime(:, :, l)) champtime(:, :, l) = EXP(champtime(:, :, l)) - where (nint(masque(:iim, :)) /= 1) champtime(:, :, l) = 0.001 + where (nint(mask(:iim, :)) /= 1) champtime(:, :, l) = 0.001 end do call NF95_CLOSE(ncid) @@ -125,6 +131,7 @@ DEALLOCATE(dlon, dlat, champ, dlon_ini, dlat_ini) allocate(yder(lmdep)) + ! Interpolate monthly values to daily values, at each horizontal position: DO j = 1, jjm + 1 DO i = 1, iim yder(:) = SPLINE(timeyear, champtime(i, j, :)) @@ -144,10 +151,12 @@ PRINT *, 'Processing sea ice...' call NF95_OPEN('amipbc_sic_1x1.nc', NF90_NOWRITE, ncid) - call nf95_get_coord(ncid, "longitude", dlon_ini) + call nf95_inq_varid(ncid, "longitude", varid) + call nf95_gw_var(ncid, varid, dlon_ini) imdep = size(dlon_ini) - call nf95_get_coord(ncid, "latitude", dlat_ini) + call nf95_inq_varid(ncid, "latitude", varid) + call nf95_gw_var(ncid, varid, dlat_ini) jmdep = size(dlat_ini) call nf95_inq_dimid(ncid, "time", dimid) @@ -241,10 +250,12 @@ PRINT *, 'Traitement de la sst' call NF95_OPEN('amipbc_sst_1x1.nc', NF90_NOWRITE, ncid) - call nf95_get_coord(ncid, "longitude", dlon_ini) + call nf95_inq_varid(ncid, "longitude", varid) + call nf95_gw_var(ncid, varid, dlon_ini) imdep = size(dlon_ini) - call nf95_get_coord(ncid, "latitude", dlat_ini) + call nf95_inq_varid(ncid, "latitude", varid) + call nf95_gw_var(ncid, varid, dlat_ini) jmdep = size(dlat_ini) call nf95_inq_dimid(ncid, "time", dimid) @@ -310,13 +321,16 @@ PRINT *, 'Traitement de l albedo' call NF95_OPEN('Albedo.nc', NF90_NOWRITE, ncid) - call nf95_get_coord(ncid, "longitude", dlon_ini) + call nf95_inq_varid(ncid, "longitude", varid) + call nf95_gw_var(ncid, varid, dlon_ini) imdep = size(dlon_ini) - call nf95_get_coord(ncid, "latitude", dlat_ini) + call nf95_inq_varid(ncid, "latitude", varid) + call nf95_gw_var(ncid, varid, dlat_ini) jmdep = size(dlat_ini) - call nf95_get_coord(ncid, "temps", timeyear) + call nf95_inq_varid(ncid, "temps", varid) + call nf95_gw_var(ncid, varid, timeyear) lmdep = size(timeyear) ALLOCATE ( champ(imdep, jmdep), champtime(iim, jjm + 1, lmdep))