Changeset 2889 for LMDZ5/trunk/libf/dynphy_lonlat
- Timestamp:
- May 23, 2017, 3:49:54 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/dynphy_lonlat/phylmd/limit_netcdf.F90
r2775 r2889 28 28 29 29 CHARACTER(LEN=20), PARAMETER :: & 30 fsst( 4)=['amipbc_sst_1x1.nc ','cpl_atm_sst.nc ','histmth_sst.nc '&31 ,' sstk.nc ']30 fsst(5)=['amipbc_sst_1x1.nc ','amip_sst_1x1.nc ','cpl_atm_sst.nc '& 31 ,'histmth_sst.nc ','sstk.nc '] 32 32 CHARACTER(LEN=20), PARAMETER :: & 33 fsic( 4)=['amipbc_sic_1x1.nc ','cpl_atm_sic.nc ','histmth_sic.nc '&34 ,' ci.nc ']33 fsic(5)=['amipbc_sic_1x1.nc ','amip_sic_1x1.nc ','cpl_atm_sic.nc '& 34 ,'histmth_sic.nc ','ci.nc '] 35 35 CHARACTER(LEN=10), PARAMETER :: & 36 vsst( 4)=['tosbcs ','SISUTESW ','tsol_oce ','sstk '],&37 vsic( 4)=['sicbcs','SIICECOV ','pourc_sic ','ci ']36 vsst(5)=['tosbcs ','tos ','SISUTESW ','tsol_oce ','sstk '], & 37 vsic(5)=['sicbcs ','sic ','SIICECOV ','pourc_sic ','ci '] 38 38 CHARACTER(LEN=10), PARAMETER :: & 39 39 frugo='Rugos.nc ', falbe='Albedo.nc ', frelf='Relief.nc ', & … … 61 61 ! * 12/2009: D. Cugnet (f77->f90, calendars, files from coupled runs) 62 62 ! * 04/2016: D. Cugnet (12/14 recs SST/SIC files: cyclic/interannual runs) 63 ! * 05/2017: D. Cugnet (linear time interpolation for BCS files) 63 64 !------------------------------------------------------------------------------- 64 65 #ifndef CPP_1D … … 102 103 INTEGER :: NF90_FORMAT 103 104 INTEGER :: ndays !--- Depending on the output calendar 105 CHARACTER(LEN=256) :: str 104 106 105 107 !--- INITIALIZATIONS ----------------------------------------------------------- … … 158 160 pctsrf_t(:,is_lic,k)=pctsrf(:,is_lic) ! land ice 159 161 SELECT CASE(ix_sic) 160 CASE( 2) ! SIC=pICE*(1-LIC-TER) (CPL)162 CASE(3) ! SIC=pICE*(1-LIC-TER) (CPL) 161 163 pctsrf_t(:,is_sic,k)=fi_ice(:)*(1.-pctsrf(:,is_lic)-pctsrf(:,is_ter)) 162 CASE( 3) ! SIC=pICE (HIST)164 CASE(4) ! SIC=pICE (HIST) 163 165 pctsrf_t(:,is_sic,k)=fi_ice(:) 164 166 CASE DEFAULT ! SIC=pICE-LIC (AMIP,ERAI) … … 223 225 CALL ncerr(NF90_CREATE(fnam,NF90_CLOBBER,nid),fnam) 224 226 CALL ncerr(NF90_PUT_ATT(nid,NF90_GLOBAL,"title","Fichier conditions aux limites"),fnam) 227 str='File produced using ce0l executable.' 228 str=TRIM(str)//NEW_LINE(' ')//'Sea Ice Concentration built from' 229 SELECT CASE(ix_sic) 230 CASE(1); str=TRIM(str)//' Amip mid-month boundary condition (BCS).' 231 CASE(2); str=TRIM(str)//' Amip monthly mean observations.' 232 CASE(3); str=TRIM(str)//' IPSL coupled model outputs.' 233 CASE(4); str=TRIM(str)//' LMDZ model outputs.' 234 CASE(5); str=TRIM(str)//' ci.nc file.' 235 END SELECT 236 str=TRIM(str)//NEW_LINE(' ')//'Sea Surface Temperature built from' 237 SELECT CASE(ix_sst) 238 CASE(1); str=TRIM(str)//' Amip mid-month boundary condition (BCS).' 239 CASE(2); str=TRIM(str)//' Amip monthly mean observations.' 240 CASE(3); str=TRIM(str)//' IPSL coupled model outputs.' 241 CASE(4); str=TRIM(str)//' LMDZ model outputs.' 242 CASE(5); str=TRIM(str)//' sstk.nc file.' 243 END SELECT 244 CALL ncerr(NF90_PUT_ATT(nid,NF90_GLOBAL,"history",TRIM(str)),fnam) 225 245 226 246 !--- Dimensions creation … … 348 368 REAL, ALLOCATABLE :: work(:,:) ! used for extrapolation 349 369 CHARACTER(LEN=128):: title, mess ! for messages 370 LOGICAL :: is_bcs ! flag for BCS data 350 371 LOGICAL :: extrp ! flag for extrapolation 351 REAL :: chmin, chmax 372 REAL :: chmin, chmax, timeday, al 352 373 INTEGER ierr, idx 353 374 integer n_extrap ! number of extrapolated points … … 365 386 END SELECT 366 387 extrp=.FALSE.; IF(PRESENT(flag).AND.mode=='SST') extrp=flag 388 is_bcs=(mode=='SIC'.AND.ix_sic==1).OR.(mode=='SST'.AND.ix_sst==1) 367 389 idx=INDEX(fnam,'.nc')-1 368 390 … … 442 464 CALL ncerr(NF90_GET_VAR(ncid,varid,champ,[1,1,l],[imdep,jmdep,1]),fnam) 443 465 !--- Check whether values are acceptable for SIC, depending on unit. 444 IF(mode=='SIC') THEN 466 !--- Dropped for mid-month boundary conditions datasets (BCS, ix_sic==1) 467 IF(mode=='SIC'.AND.ix_sic/=1) THEN 445 468 IF(TRIM(unit_sic)=="1".OR.TRIM(unit_sic)=="1.0") THEN 446 469 IF(ANY(champ>1.0+EPSFRA)) & 447 470 CALL abort_physic('SIC','Found sea-ice fractions greater than 1.') 448 471 ELSE IF(TRIM(unit_sic)=="X".OR.TRIM(unit_sic)=="%") THEN 449 !IF(ANY(champ>100.0+EPSFRA)) &450 !CALL abort_physic('SIC','Found sea-ice percentages greater than 100.')472 IF(ANY(champ>100.0+EPSFRA)) & 473 CALL abort_physic('SIC','Found sea-ice percentages greater than 100.') 451 474 IF(MAXVAL(champ)< 1.01) & 452 475 CALL abort_physic('SIC','All sea-ice percentages lower than 1.') … … 529 552 WRITE(lunout, *)' Daily input file.' 530 553 ELSE 531 WRITE(lunout, *)'TIME INTERPOLATION.' 554 IF( is_bcs) WRITE(lunout, *)'LINEAR TIME INTERPOLATION.' 555 IF(.NOT.is_bcs) WRITE(lunout, *)'SPLINES TIME INTERPOLATION.' 532 556 WRITE(lunout, *)' Input time vector: ', timeyear 533 557 WRITE(lunout, *)' Output time vector from 0 to ', ndays-1 534 558 END IF 535 559 END IF 536 ALLOCATE(yder(lmdep+2), champan(iip1, jjp1, ndays)) 537 IF(lmdep==ndays_in) THEN 560 ALLOCATE(champan(iip1, jjp1, ndays)) 561 562 IF(lmdep==ndays_in) THEN !--- DAILY DATA: NO TIME INTERPOLATION 538 563 champan(1:iim,:,:)=champtime 539 ELSE 564 ELSE IF(is_bcs) THEN !--- BCS DATA: LINEAR TIME INTERPOLATION 565 l=1 566 DO k=1, ndays 567 timeday = REAL((k-1)*ndays_in)/ndays 568 IF(timeyear(l+1)<timeday) l=l+1 569 al=(timeday-timeyear(l))/(timeyear(l+1)-timeyear(l)) 570 DO j=1, jjp1 571 DO i=1, iim 572 champan(i,j,k) = champtime(i,j,l)+al*(champtime(i,j,l+1)-champtime(i,j,l)) 573 END DO 574 END DO 575 END DO 576 ELSE !--- AVE DATA: SPLINE TIME INTERPOLATION 540 577 skip = .false. 541 578 n_extrap = 0 579 ALLOCATE(yder(lmdep+2)) 542 580 DO j=1, jjp1 543 581 DO i=1, iim … … 551 589 END DO 552 590 IF(n_extrap /= 0) WRITE(lunout,*) "get_2Dfield pchfe_95: n_extrap = ", n_extrap 591 DEALLOCATE(yder) 553 592 END IF 554 593 champan(iip1, :, :)=champan(1, :, :) 555 DEALLOCATE( yder,champtime, timeyear)594 DEALLOCATE(champtime, timeyear) 556 595 557 596 !--- Checking the result
Note: See TracChangeset
for help on using the changeset viewer.