Changeset 4245 for branches/2013/dev_LOCEAN_CMCC_INGV_MERC_UKMO_2013/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90
- Timestamp:
- 2013-11-19T12:19:21+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2013/dev_LOCEAN_CMCC_INGV_MERC_UKMO_2013/NEMOGCM/NEMO/OPA_SRC/SBC/fldread.F90
r4230 r4245 23 23 USE lib_mpp ! MPP library 24 24 USE wrk_nemo ! work arrays 25 USE lbclnk ! ocean lateral boundary conditions (C1D case) 25 26 USE ioipsl, ONLY : ymds2ju, ju2ymds ! for calendar 26 27 USE sbc_oce … … 34 35 TYPE, PUBLIC :: FLD_N !: Namelist field informations 35 36 CHARACTER(len = 256) :: clname ! generic name of the NetCDF flux file 36 INTEGER:: nfreqh ! frequency of each flux file37 REAL(wp) :: nfreqh ! frequency of each flux file 37 38 CHARACTER(len = 34) :: clvar ! generic name of the variable in the NetCDF flux file 38 39 LOGICAL :: ln_tint ! time interpolation or not (T/F) … … 50 51 CHARACTER(len = 256) :: clrootname ! generic name of the NetCDF file 51 52 CHARACTER(len = 256) :: clname ! current name of the NetCDF file 52 INTEGER:: nfreqh ! frequency of each flux file53 REAL(wp) :: nfreqh ! frequency of each flux file 53 54 CHARACTER(len = 34) :: clvar ! generic name of the variable in the NetCDF flux file 54 55 LOGICAL :: ln_tint ! time interpolation or not (T/F) … … 200 201 sd(jf)%fdta(:,:,:,1) = sd(jf)%fdta(:,:,:,2) ! re-swap before record field 201 202 sd(jf)%nrec_b(1) = sd(jf)%nrec_a(1) ! update before record informations 202 sd(jf)%nrec_b(2) = sd(jf)%nrec_a(2) - sd(jf)%nfreqh * 3600! assume freq to be in hours in this case203 sd(jf)%nrec_b(2) = sd(jf)%nrec_a(2) - NINT( sd(jf)%nfreqh * 3600 ) ! assume freq to be in hours in this case 203 204 sd(jf)%rotn(1) = sd(jf)%rotn(2) ! update before rotate informations 204 205 sd(jf)%nrec_a(1) = itmp ! move back to after record … … 218 219 sd(jf)%fdta(:,:,:,1) = sd(jf)%fdta(:,:,:,2) ! re-swap before record field 219 220 sd(jf)%nrec_b(1) = sd(jf)%nrec_a(1) ! update before record informations 220 sd(jf)%nrec_b(2) = sd(jf)%nrec_a(2) - sd(jf)%nfreqh * 3600! assume freq to be in hours in this case221 sd(jf)%nrec_b(2) = sd(jf)%nrec_a(2) - NINT( sd(jf)%nfreqh * 3600 ) ! assume freq to be in hours in this case 221 222 sd(jf)%rotn(1) = sd(jf)%rotn(2) ! update before rotate informations 222 223 sd(jf)%nrec_a(1) = sd(jf)%nrec_a(1) + 1 ! move back to after record … … 271 272 IF( sd(jf)%ln_tint ) THEN ! temporal interpolation 272 273 IF(lwp .AND. kt - nit000 <= 100 ) THEN 273 clfmt = "('fld_read: var ', a, ' kt = ', i8, ' (', f 7.2,' days), Y/M/D = ', i4.4,'/', i2.2,'/', i2.2," // &274 & "', records b/a: ', i 4.4, '/', i4.4, ' (days ', f7.2,'/', f7.2, ')')"274 clfmt = "('fld_read: var ', a, ' kt = ', i8, ' (', f9.4,' days), Y/M/D = ', i4.4,'/', i2.2,'/', i2.2," // & 275 & "', records b/a: ', i6.4, '/', i6.4, ' (days ', f9.4,'/', f9.4, ')')" 275 276 WRITE(numout, clfmt) TRIM( sd(jf)%clvar ), kt, REAL(isecsbc,wp)/rday, nyear, nmonth, nday, & 276 277 & sd(jf)%nrec_b(1), sd(jf)%nrec_a(1), REAL(sd(jf)%nrec_b(2),wp)/rday, REAL(sd(jf)%nrec_a(2),wp)/rday … … 284 285 ELSE ! nothing to do... 285 286 IF(lwp .AND. kt - nit000 <= 100 ) THEN 286 clfmt = "('fld_read: var ', a, ' kt = ', i8,' (', f 7.2,' days), Y/M/D = ', i4.4,'/', i2.2,'/', i2.2," // &287 & "', record: ', i 4.4, ' (days ', f7.2, ' <-> ', f7.2, ')')"287 clfmt = "('fld_read: var ', a, ' kt = ', i8,' (', f9.4,' days), Y/M/D = ', i4.4,'/', i2.2,'/', i2.2," // & 288 & "', record: ', i6.4, ' (days ', f9.4, ' <-> ', f9.4, ')')" 288 289 WRITE(numout, clfmt) TRIM(sd(jf)%clvar), kt, REAL(isecsbc,wp)/rday, nyear, nmonth, nday, & 289 290 & sd(jf)%nrec_a(1), REAL(sd(jf)%nrec_b(2),wp)/rday, REAL(sd(jf)%nrec_a(2),wp)/rday … … 356 357 ELSE ! higher frequency mean (in hours) 357 358 IF ( sdjf%cltype == 'monthly' ) THEN ! monthly file 358 sdjf%nrec_a(1) = 24 * nmonth_len(nmonth-1) / sdjf%nfreqh! last record of previous month359 sdjf%nrec_a(1) = NINT( 24 * nmonth_len(nmonth-1) / sdjf%nfreqh ) ! last record of previous month 359 360 llprevmth = .TRUE. ! use previous month file? 360 361 llprevyr = llprevmth .AND. nmonth == 1 ! use previous year file? 361 362 ELSEIF( sdjf%cltype(1:4) == 'week' ) THEN ! weekly file 362 363 llprevweek = .TRUE. ! use previous week file? 363 sdjf%nrec_a(1) = 24 * 7 / sdjf%nfreqh! last record of previous week364 sdjf%nrec_a(1) = NINT( 24 * 7 / sdjf%nfreqh ) ! last record of previous week 364 365 isec_week = NINT(rday) * 7 ! add a shift toward previous week 365 366 ELSEIF( sdjf%cltype == 'daily' ) THEN ! daily file 366 sdjf%nrec_a(1) = 24 / sdjf%nfreqh! last record of previous day367 sdjf%nrec_a(1) = NINT( 24 / sdjf%nfreqh ) ! last record of previous day 367 368 llprevday = .TRUE. ! use previous day file? 368 369 llprevmth = llprevday .AND. nday == 1 ! use previous month file? 369 370 llprevyr = llprevmth .AND. nmonth == 1 ! use previous year file? 370 371 ELSE ! yearly file 371 sdjf%nrec_a(1) = 24 * nyear_len(0) / sdjf%nfreqh! last record of previous year372 sdjf%nrec_a(1) = NINT( 24 * nyear_len(0) / sdjf%nfreqh ) ! last record of previous year 372 373 llprevyr = .NOT. sdjf%ln_clim ! use previous year file? 373 374 ENDIF … … 408 409 CALL fld_get( sdjf, map ) 409 410 410 clfmt = "('fld_init : time-interpolation for ', a, ' read previous record = ', i 4, ' at time = ', f7.2, ' days')"411 clfmt = "('fld_init : time-interpolation for ', a, ' read previous record = ', i6, ' at time = ', f7.2, ' days')" 411 412 IF(lwp) WRITE(numout, clfmt) TRIM(sdjf%clvar), sdjf%nrec_a(1), REAL(sdjf%nrec_a(2),wp)/rday 412 413 … … 518 519 ! ! ================================ ! 519 520 ! 520 ifreq_sec = sdjf%nfreqh * 3600! frequency mean (in seconds)521 ifreq_sec = NINT( sdjf%nfreqh * 3600 ) ! frequency mean (in seconds) 521 522 IF( sdjf%cltype(1:4) == 'week' ) isec_week = ksec_week( sdjf%cltype(6:8) ) ! since the first day of the current week 522 523 ! number of second since the beginning of the file … … 588 589 INTEGER :: iw ! index into wgts array 589 590 INTEGER :: ipdom ! index of the domain 591 INTEGER :: idvar ! variable ID 592 INTEGER :: idmspc ! number of spatial dimensions 593 LOGICAL :: lmoor ! C1D case: point data 590 594 !!--------------------------------------------------------------------- 591 595 ! … … 607 611 ELSE ; ipdom = jpdom_unknown 608 612 ENDIF 613 ! C1D case: If product of spatial dimensions == ipk, then x,y are of 614 ! size 1 (point/mooring data): this must be read onto the central grid point 615 idvar = iom_varid( sdjf%num, sdjf%clvar ) 616 idmspc = iom_file( sdjf%num )%ndims( idvar ) 617 IF( iom_file( sdjf%num )%luld( idvar ) ) idmspc = idmspc - 1 618 lmoor = (idmspc == 0 .OR. PRODUCT( iom_file( sdjf%num )%dimsz( 1:MAX(idmspc,1) ,idvar ) ) == ipk) 619 ! 609 620 SELECT CASE( ipk ) 610 621 CASE(1) 611 IF( sdjf%ln_tint ) THEN ; CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fdta(:,:,1,2), sdjf%nrec_a(1) ) 612 ELSE ; CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fnow(:,:,1 ), sdjf%nrec_a(1) ) 622 IF( lk_c1d .AND. lmoor ) THEN 623 IF( sdjf%ln_tint ) THEN 624 CALL iom_get( sdjf%num, sdjf%clvar, sdjf%fdta(2,2,1,2), sdjf%nrec_a(1) ) 625 CALL lbc_lnk( sdjf%fdta(:,:,1,2),'Z',1. ) 626 ELSE 627 CALL iom_get( sdjf%num, sdjf%clvar, sdjf%fnow(2,2,1 ), sdjf%nrec_a(1) ) 628 CALL lbc_lnk( sdjf%fnow(:,:,1 ),'Z',1. ) 629 ENDIF 630 ELSE 631 IF( sdjf%ln_tint ) THEN ; CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fdta(:,:,1,2), sdjf%nrec_a(1) ) 632 ELSE ; CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fnow(:,:,1 ), sdjf%nrec_a(1) ) 633 ENDIF 613 634 ENDIF 614 635 CASE DEFAULT 615 IF( sdjf%ln_tint ) THEN ; CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_a(1) ) 616 ELSE ; CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fnow(:,:,: ), sdjf%nrec_a(1) ) 636 IF (lk_c1d .AND. lmoor ) THEN 637 IF( sdjf%ln_tint ) THEN 638 CALL iom_get( sdjf%num, jpdom_unknown, sdjf%clvar, sdjf%fdta(2,2,:,2), sdjf%nrec_a(1) ) 639 CALL lbc_lnk( sdjf%fdta(:,:,:,2),'Z',1. ) 640 ELSE 641 CALL iom_get( sdjf%num, jpdom_unknown, sdjf%clvar, sdjf%fnow(2,2,: ), sdjf%nrec_a(1) ) 642 CALL lbc_lnk( sdjf%fnow(:,:,: ),'Z',1. ) 643 ENDIF 644 ELSE 645 IF( sdjf%ln_tint ) THEN ; CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fdta(:,:,:,2), sdjf%nrec_a(1) ) 646 ELSE ; CALL iom_get( sdjf%num, ipdom, sdjf%clvar, sdjf%fnow(:,:,: ), sdjf%nrec_a(1) ) 647 ENDIF 617 648 ENDIF 618 649 END SELECT … … 826 857 ENDIF 827 858 ELSE ! higher frequency mean (in hours) 828 IF( sdjf%cltype == 'monthly' ) THEN ; sdjf%nreclast = 24 * imonth_len / sdjf%nfreqh829 ELSEIF( sdjf%cltype(1:4) == 'week' ) THEN ; sdjf%nreclast = 24 * 7 / sdjf%nfreqh830 ELSEIF( sdjf%cltype == 'daily' ) THEN ; sdjf%nreclast = 24 / sdjf%nfreqh831 ELSE ; sdjf%nreclast = 24 * iyear_len / sdjf%nfreqh859 IF( sdjf%cltype == 'monthly' ) THEN ; sdjf%nreclast = NINT( 24 * imonth_len / sdjf%nfreqh ) 860 ELSEIF( sdjf%cltype(1:4) == 'week' ) THEN ; sdjf%nreclast = NINT( 24 * 7 / sdjf%nfreqh ) 861 ELSEIF( sdjf%cltype == 'daily' ) THEN ; sdjf%nreclast = NINT( 24 / sdjf%nfreqh ) 862 ELSE ; sdjf%nreclast = NINT( 24 * iyear_len / sdjf%nfreqh ) 832 863 ENDIF 833 864 ENDIF
Note: See TracChangeset
for help on using the changeset viewer.