diff --git a/LIBTOOLS/tools/lfi2cdf/src/fieldtype.f90 b/LIBTOOLS/tools/lfi2cdf/src/fieldtype.f90 deleted file mode 100644 index afcfa98948b760a82d6adf25c13459d8e5a646cf..0000000000000000000000000000000000000000 --- a/LIBTOOLS/tools/lfi2cdf/src/fieldtype.f90 +++ /dev/null @@ -1,368 +0,0 @@ -MODULE MODE_FIELDTYPE - USE MODD_PARAM - - IMPLICIT NONE - - PRIVATE - - - TYPE field - CHARACTER(LEN=FM_FIELD_SIZE) :: name ! Le nom de l'article LFI - INTEGER :: TYPE ! Type :entier(TYPEINT) ou reel(TYPEREAL) - INTEGER :: dim ! Dimension de l'article - END TYPE field - - TYPE(field), DIMENSION(:), ALLOCATABLE :: userfield - - ! Les champs contenant %TDATE et %TIME sont traites en dur - ! dans la routine de recherche de type - TYPE(field), DIMENSION(2), PARAMETER :: datefield = (/& - field('%TDA', TYPEINT, D0), & - field('%TIM', TYPEREAL, D0) & - /) - - TYPE(field), DIMENSION(219), SAVE :: sysfield - - PUBLIC :: get_ftype, init_sysfield - -CONTAINS -SUBROUTINE init_sysfield() -sysfield(1) = field('LBXSVMxxx', TYPEREAL , D0) -sysfield(2) = field('LBYSVMxxx', TYPEREAL , D0) -sysfield(3) = field('LBXUM', TYPEREAL, D0) -sysfield(4) = field('LBYUM', TYPEREAL, D0) -sysfield(5) = field('LBXVM', TYPEREAL, D0) -sysfield(6) = field('LBYVM', TYPEREAL, D0) -sysfield(7) = field('LBXWM', TYPEREAL, D0) -sysfield(8) = field('LBYWM', TYPEREAL, D0) -sysfield(9) = field('LBXTHM', TYPEREAL, D0) -sysfield(10) = field('LBYTHM', TYPEREAL, D0) -sysfield(11) = field('LBXRVM', TYPEREAL, D0) -sysfield(12) = field('LBYRVM', TYPEREAL, D0) -sysfield(13) = field('AVG_ZS', TYPEREAL, D0) -sysfield(14) = field('SIL_ZS', TYPEREAL, D0) -sysfield(15) = field('AOSIP', TYPEREAL, D0) -sysfield(16) = field('AOSIM', TYPEREAL, D0) -sysfield(17) = field('AOSJP', TYPEREAL, D0) -sysfield(18) = field('AOSJM', TYPEREAL, D0) -sysfield(19) = field('HO2IP', TYPEREAL, D0) -sysfield(20) = field('HO2IM', TYPEREAL, D0) -sysfield(21) = field('HO2JP', TYPEREAL, D0) -sysfield(22) = field('HO2JM', TYPEREAL, D0) -sysfield(23) = field('RIMX',TYPEINT, D0) -sysfield(24) = field('RIMY',TYPEINT, D0) -sysfield(25) = field('HORELAX_UVWTH',TYPELOG, D0) -sysfield(26) = field('HORELAX_R',TYPELOG, D0) -sysfield(27) = field('I2D_XY', TYPEINT, D0) -sysfield(28) = field('MENU_BUDGET',TYPECHAR, D0) -sysfield(29) = field('IE', TYPEINT, D0) -sysfield(30) = field('ZR', TYPEREAL, D0) -sysfield(31) = field('GOK', TYPELOG, D0) -sysfield(32) = field('YTEXT', TYPECHAR, D0) -sysfield(33) = field('X1D', TYPEREAL, D0) -sysfield(34) = field('I1D', TYPEINT, D0) -sysfield(35) = field('DEB', TYPEINT, D0) -sysfield(36) = field('3D1', TYPEREAL, D0) -sysfield(37) = field('3D2', TYPEREAL, D0) -sysfield(38) = field('3D3', TYPEREAL, D0) -sysfield(39) = field('3D4', TYPEREAL, D0) -sysfield(40) = field('3D5', TYPEREAL, D0) -sysfield(41) = field('RHODREFZ', TYPEREAL, D0) -sysfield(42) = field('RSVS', TYPEREAL, D0) -sysfield(43) = field('RUS', TYPEREAL, D0) -sysfield(44) = field('MY_NAME', TYPECHAR, D0) -sysfield(45) = field('DAD_NAME', TYPECHAR, D0) -sysfield(46) = field('STORAGE_TYPE', TYPECHAR, D0) -sysfield(47) = field('IMAX', TYPEINT, D0) -sysfield(48) = field('JMAX', TYPEINT, D0) -sysfield(49) = field('KMAX', TYPEINT, D0) -sysfield(50) = field('RPK', TYPEREAL, D0) -sysfield(51) = field('NEB', TYPEREAL , D0) -sysfield(52) = field('LONOR', TYPEREAL, D0) -sysfield(53) = field('LATOR', TYPEREAL, D0) -sysfield(54) = field('THINSHELL', TYPELOG, D0) -sysfield(55) = field('LAT0', TYPEREAL, D0) -sysfield(56) = field('LON0', TYPEREAL, D0) -sysfield(57) = field('BETA', TYPEREAL, D0) -sysfield(58) = field('XHAT', TYPEREAL, D0) -sysfield(59) = field('YHAT', TYPEREAL, D0) -sysfield(60) = field('ZHAT', TYPEREAL, D0) -sysfield(61) = field('ZS', TYPEREAL, D0) -sysfield(62) = field('CARTESIAN', TYPELOG, D0) -sysfield(63) = field('UM', TYPEREAL, D0) -sysfield(64) = field('VM', TYPEREAL, D0) -sysfield(65) = field('WM', TYPEREAL, D0) -sysfield(66) = field('THM', TYPEREAL, D0) -sysfield(67) = field('TKEM', TYPEREAL, D0) -sysfield(68) = field('EPSM', TYPEREAL, D0) -sysfield(69) = field('PABSM',TYPEREAL, D0) -sysfield(70) = field('RVM', TYPEREAL, D0) -sysfield(71) = field('RCM', TYPEREAL, D0) -sysfield(72) = field('RRM', TYPEREAL, D0) -sysfield(73) = field('RIM', TYPEREAL, D0) -sysfield(74) = field('RSM', TYPEREAL, D0) -sysfield(75) = field('RGM', TYPEREAL, D0) -sysfield(76) = field('RHM', TYPEREAL, D0) -sysfield(77) = field('SVMxxx', TYPEREAL, D0) -sysfield(78) = field('LSUM', TYPEREAL, D0) -sysfield(79) = field('LSVM', TYPEREAL, D0) -sysfield(80) = field('LSWM',TYPEREAL , D0) -sysfield(81) = field('LSTHM',TYPEREAL, D0) -sysfield(82) = field('LSRVM',TYPEREAL, D0) -sysfield(83) = field('LSXTKEM',TYPEREAL, D0) -sysfield(84) = field('LSYTKEM',TYPEREAL, D0) -sysfield(85) = field('LSXEPSM',TYPEREAL, D0) -sysfield(86) = field('LSYEPSM',TYPEREAL, D0) -sysfield(87) = field('LSXRCM',TYPEREAL , D0) -sysfield(88) = field('LSYRCM', TYPEREAL, D0) -sysfield(89) = field('LSXRRM', TYPEREAL, D0) -sysfield(90) = field('LSYRRM', TYPEREAL, D0) -sysfield(91) = field('LSXRIM', TYPEREAL, D0) -sysfield(92) = field('LSYRIM', TYPEREAL, D0) -sysfield(93) = field('LSXRSM', TYPEREAL, D0) -sysfield(94) = field('LSYRSM', TYPEREAL, D0) -sysfield(95) = field('LSXRGM', TYPEREAL, D0) -sysfield(96) = field('LSYRGM', TYPEREAL, D0) -sysfield(97) = field('LSXRHM', TYPEREAL, D0) -sysfield(98) = field('LSYRHM', TYPEREAL, D0) -sysfield(99) = field('LSXSVMxxx', TYPEREAL, D0) -sysfield(100) = field('LSYSVMxxx', TYPEREAL, D0) -sysfield(101) = field('UT',TYPEREAL, D0) -sysfield(102) = field('VT',TYPEREAL, D0) -sysfield(103) = field('WT',TYPEREAL, D0) -sysfield(104) = field('THT',TYPEREAL, D0) -sysfield(105) = field('TKET',TYPEREAL, D0) -sysfield(106) = field('EPST',TYPEREAL, D0) -sysfield(107) = field('PABST',TYPEREAL, D0) -sysfield(108) = field('RVT',TYPEREAL, D0) -sysfield(109) = field('RCT',TYPEREAL, D0) -sysfield(110) = field('RRT',TYPEREAL, D0) -sysfield(111) = field('RIT',TYPEREAL, D0) -sysfield(112) = field('CIT',TYPEREAL, D0) -sysfield(113) = field('RST',TYPEREAL, D0) -sysfield(114) = field('RGT',TYPEREAL, D0) -sysfield(115) = field('RHT',TYPEREAL, D0) -sysfield(116) = field('SVTxxx',TYPEREAL, D0) -sysfield(117) = field('DRYMASST',TYPEREAL, D0) -sysfield(118) = field('SRCM',TYPEREAL, D0) -sysfield(119) = field('SRCT',TYPEREAL, D0) -sysfield(120) = field('SIGS',TYPEREAL, D0) -sysfield(121) = field('RHOREFZ',TYPEREAL, D0) -sysfield(122) = field('THVREFZ',TYPEREAL, D0) -sysfield(123) = field('EXNTOP',TYPEREAL, D0) -sysfield(124) = field('RESA', TYPEREAL , D0) -sysfield(125) = field('Z0SEA', TYPEREAL , D0) -sysfield(126) = field('TS', TYPEREAL , D0) -sysfield(127) = field('WG', TYPEREAL , D0) -sysfield(128) = field('SST', TYPEREAL , D0) -sysfield(129) = field('T2', TYPEREAL , D0) -sysfield(130) = field('W2', TYPEREAL , D0) -sysfield(131) = field('WR', TYPEREAL , D0) -sysfield(132) = field('WS', TYPEREAL , D0) -sysfield(133) = field('ALBS', TYPEREAL , D0) -sysfield(134) = field('RHOS', TYPEREAL , D0) -sysfield(135) = field('LAND', TYPEREAL , D0) -sysfield(136) = field('SEA', TYPEREAL , D0) -sysfield(137) = field('Z0VEG', TYPEREAL , D0) -sysfield(138) = field('Z0HVEG', TYPEREAL , D0) -sysfield(139) = field('Z0REL', TYPEREAL , D0) -sysfield(140) = field('Z0EFFIP', TYPEREAL , D0) -sysfield(141) = field('Z0EFFIM', TYPEREAL , D0) -sysfield(142) = field('Z0EFFJP', TYPEREAL , D0) -sysfield(143) = field('Z0EFFJM', TYPEREAL , D0) -sysfield(144) = field('SSO_STDEV', TYPEREAL , D0) -sysfield(145) = field('SSO_ANIS', TYPEREAL , D0) -sysfield(146) = field('SSO_DIRECTION', TYPEREAL , D0) -sysfield(147) = field('SSO_SLOPE', TYPEREAL , D0) -sysfield(148) = field('ALBVIS', TYPEREAL , D0) -sysfield(149) = field('ALBNIR', TYPEREAL , D0) -sysfield(150) = field('EMIS', TYPEREAL , D0) -sysfield(151) = field('CLAY', TYPEREAL , D0) -sysfield(152) = field('SAND', TYPEREAL , D0) -sysfield(153) = field('D2', TYPEREAL , D0) -sysfield(154) = field('VEG', TYPEREAL , D0) -sysfield(155) = field('LAI', TYPEREAL , D0) -sysfield(156) = field('RSMIN', TYPEREAL , D0) -sysfield(157) = field('GAMMA', TYPEREAL , D0) -sysfield(158) = field('RGL', TYPEREAL , D0) -sysfield(159) = field('CV', TYPEREAL , D0) -sysfield(160) = field('SFTHT', TYPEREAL , D0) -sysfield(161) = field('SFTHP', TYPEREAL , D0) -sysfield(162) = field('SFRT', TYPEREAL , D0) -sysfield(163) = field('SFRP', TYPEREAL , D0) -sysfield(164) = field('SFSVT', TYPEREAL , D0) -sysfield(165) = field('SFSVP', TYPEREAL , D0) -sysfield(166) = field('DTHRAD', TYPEREAL , D0) -sysfield(167) = field('SRFLWD', TYPEREAL , D0) -sysfield(168) = field('SRFSWD', TYPEREAL , D0) -sysfield(169) = field('CLDFR', TYPEREAL , D0) -sysfield(170) = field('COUNTCONV', TYPEINT , D0) -sysfield(171) = field('DTHCONV', TYPEREAL , D0) -sysfield(172) = field('DRVCONV', TYPEREAL , D0) -sysfield(173) = field('DRCCONV', TYPEREAL , D0) -sysfield(174) = field('DRICONV', TYPEREAL , D0) -sysfield(175) = field('PRCONV', TYPEREAL , D0) -sysfield(176) = field('PACCONV', TYPEREAL , D0) -sysfield(177) = field('WSUBCONV', TYPEREAL , D0) -sysfield(178) = field('INPRR', TYPEREAL , D0) -sysfield(179) = field('ACPRR', TYPEREAL , D0) -sysfield(180) = field('INPRS', TYPEREAL , D0) -sysfield(181) = field('ACPRS', TYPEREAL , D0) -sysfield(182) = field('INPRG', TYPEREAL , D0) -sysfield(183) = field('ACPRG', TYPEREAL , D0) -sysfield(184) = field('INPRT', TYPEREAL , D0) -sysfield(185) = field('ACPRT', TYPEREAL , D0) -sysfield(186) = field('FRC', TYPEINT, D0) -sysfield(187) = field('UFRCxx', TYPEREAL , D0) -sysfield(188) = field('VFRCxx', TYPEREAL , D0) -sysfield(189) = field('WFRCxx', TYPEREAL , D0) -sysfield(190) = field('THFRCxx', TYPEREAL , D0) -sysfield(191) = field('RVFRCxx', TYPEREAL , D0) -sysfield(192) = field('GXRVFRCxx', TYPEREAL , D0) -sysfield(193) = field('GYRVFRCxx', TYPEREAL , D0) -sysfield(194) = field('GXTHFRCxx', TYPEREAL , D0) -sysfield(195) = field('GYTHFRCxx', TYPEREAL , D0) -sysfield(196) = field('DUMMY_GRxxx', TYPEREAL , D0) -sysfield(197) = field('MASDEV', TYPEINT , D0) -sysfield(198) = field('EMISFILE_GR_NBR', TYPEINT , D0) -sysfield(199) = field('EMISPEC_GR_NBR', TYPEINT , D0) -sysfield(200) = field('EMISNAMExxx', TYPECHAR , D0) -sysfield(201) = field('EMISTIMESxxx', TYPEINT , D0) -sysfield(202) = field('DUMMY_GR_NBR', TYPEINT , D0) -sysfield(203) = field('COVERxxx', TYPEREAL , D0) -sysfield(204) = field('TGx', TYPEREAL, D0) -sysfield(205) = field('T_ROOFx', TYPEREAL, D0) -sysfield(206) = field('T_ROADx', TYPEREAL, D0) -sysfield(207) = field('T_WALLx', TYPEREAL, D0) -sysfield(208) = field('WGx', TYPEREAL, D0) -sysfield(209) = field('WGIx', TYPEREAL, D0) -sysfield(210) = field('MAX_ZS', TYPEREAL, D0) -sysfield(211) = field('MIN_ZS', TYPEREAL, D0) -sysfield(212) = field('XOR', TYPEINT, D0) -sysfield(213) = field('YOR', TYPEINT, D0) -sysfield(214) = field('DXRATIO', TYPEINT, D0) -sysfield(215) = field('DYRATIO', TYPEINT, D0) -sysfield(216) = field('PATCH_NUMBER', TYPEINT, D0) -sysfield(217) = field('BUGFIX', TYPEINT, D0) -sysfield(218) = field('BIBUSER', TYPECHAR, D0) -sysfield(219) = field('LFI_COMPRESSED', TYPEINT, D0) -END SUBROUTINE init_sysfield - - FUNCTION get_ftype(hfname,level) - CHARACTER(LEN=*) :: hfname - INTEGER :: get_ftype - INTEGER,INTENT(IN) :: level - - TYPE(field) :: tzf - - ! Is this a diachronic field ? - IF (INDEX(hfname,".TY",.TRUE.) /=0 .OR.& - & INDEX(hfname,".TI",.TRUE.) /=0 .OR.& - & INDEX(hfname,".UN",.TRUE.) /=0 .OR.& - & INDEX(hfname,".CO",.TRUE.)/=0) THEN - get_ftype = TYPECHAR - ELSE IF (INDEX(hfname,".DI",.TRUE.) /= 0) THEN - get_ftype = TYPEINT - ELSE IF (INDEX(hfname,".PR",.TRUE.)/= 0 .OR.& - & INDEX(hfname,".TR",.TRUE.)/= 0 .OR.& - & INDEX(hfname,".DA",.TRUE.)/= 0) THEN - get_ftype = TYPEREAL - ELSE IF (searchfield(hfname,tzf,level)) THEN - ! search in databases - get_ftype = tzf%TYPE - ELSE - get_ftype = -1 - END IF - - END FUNCTION get_ftype - - FUNCTION searchfield(hfname, tpf, level) - CHARACTER(LEN=*), INTENT(IN) :: hfname - TYPE(field), INTENT(OUT) :: tpf - INTEGER,INTENT(IN) :: level - LOGICAL :: searchfield - - INTEGER :: ji,iposx - LOGICAL :: found - CHARACTER(LEN=4) :: clevel - - found = .FALSE. - - ! First is this a date field ? - DO ji=1,SIZE(datefield) - IF (INDEX(hfname,TRIM(datefield(ji)%name)) /= 0) THEN - found = .TRUE. - tpf = datefield(ji) - EXIT - END IF - END DO - - IF (.NOT. found) THEN - ! Next, search in user field tab - IF (ALLOCATED(userfield)) THEN - DO ji=1,SIZE(userfield) - IF (hfname==userfield(ji)%name) THEN - found = .TRUE. - tpf = userfield(ji) - EXIT - END IF - END DO - END IF - - IF (.NOT. found) THEN - ! then search in system field tab - DO ji=1,SIZE(sysfield) - IF (hfname==sysfield(ji)%name) THEN - found = .TRUE. - tpf = sysfield(ji) - EXIT - ELSE - iposx = INDEX(sysfield(ji)%name,'x') - IF (iposx /= 0) THEN - IF (isnumeric(hfname(iposx:LEN_TRIM(sysfield(ji)%name))) .AND. & - sysfield(ji)%name(1:iposx-1)//& - hfname(iposx:LEN_TRIM(sysfield(ji)%name))==hfname) THEN - found = .TRUE. - tpf = sysfield(ji) - EXIT - END IF - ELSE IF (level>-1) THEN - !Maybe it is a z-level splitted field - !Warning: false positives are possible (but should be rare) - write(clevel,'(I4.4)') level - iposx = INDEX(hfname,clevel) - IF (iposx /= 0) THEN - IF (hfname(:iposx-1)==sysfield(ji)%name) THEN - found = .TRUE. - tpf = sysfield(ji) - EXIT - END IF - END IF - END IF - END IF - END DO - END IF - END IF - - searchfield = found - - END FUNCTION searchfield - - FUNCTION isnumeric(hname) - CHARACTER(LEN=*) :: hname - LOGICAL :: isnumeric - - INTEGER :: ji - - isnumeric = .TRUE. - - DO ji = 1,LEN(hname) - IF (hname(ji:ji) > '9' .OR. hname(ji:ji) < '0') THEN - isnumeric = .FALSE. - EXIT - END IF - END DO - - END FUNCTION isnumeric - -END MODULE MODE_FIELDTYPE diff --git a/LIBTOOLS/tools/lfi2cdf/src/lfi2cdf.f90 b/LIBTOOLS/tools/lfi2cdf/src/lfi2cdf.f90 index b2ab840d0e763b19c45c4354b59f00f132cd6a8f..2589cf54658225b09b5833bef7a5d0bf2c72dd3a 100644 --- a/LIBTOOLS/tools/lfi2cdf/src/lfi2cdf.f90 +++ b/LIBTOOLS/tools/lfi2cdf/src/lfi2cdf.f90 @@ -22,7 +22,6 @@ program LFI2CDF INTEGER :: nbvar_calc ! number of variables to be computed from others INTEGER :: nbvar_tbw ! number of variables to be written INTEGER :: nbvar ! number of defined variables - INTEGER :: first_level, current_level, last_level, nb_levels INTEGER :: IINFO_ll ! return code of // routines CHARACTER(LEN=:),allocatable :: hvarlist TYPE(filelist_struct) :: infiles, outfiles @@ -117,14 +116,14 @@ program LFI2CDF ELSE IF (runmode == MODECDF2CDF) THEN ! Conversion netCDF -> netCDF - CALL parse_infiles(infiles,nbvar_infile,nbvar_tbr,nbvar_calc,nbvar_tbw,tzreclist,ibuflen,options,current_level) + CALL parse_infiles(infiles,nbvar_infile,nbvar_tbr,nbvar_calc,nbvar_tbw,tzreclist,ibuflen,options) IF (options(OPTSPLIT)%set) call open_split_ncfiles_out(outfiles,houtfile,nbvar,tzreclist,options) CALL def_ncdf(outfiles,tzreclist,nbvar,options) CALL fill_ncdf(infiles,outfiles,tzreclist,nbvar,ibuflen,options) ELSE ! Conversion NetCDF -> LFI - CALL parse_infiles(infiles,nbvar_infile,nbvar_tbr,nbvar_calc,nbvar_tbw,tzreclist,ibuflen,options,current_level) + CALL parse_infiles(infiles,nbvar_infile,nbvar_tbr,nbvar_calc,nbvar_tbw,tzreclist,ibuflen,options) CALL build_lfi(infiles,outfiles,tzreclist,nbvar_infile,ibuflen) END IF diff --git a/LIBTOOLS/tools/lfi2cdf/src/modd_ncparam.f90 b/LIBTOOLS/tools/lfi2cdf/src/modd_ncparam.f90 deleted file mode 100644 index 11c85ed7a8353349ba38b3970dba0ea749d74eac..0000000000000000000000000000000000000000 --- a/LIBTOOLS/tools/lfi2cdf/src/modd_ncparam.f90 +++ /dev/null @@ -1,17 +0,0 @@ -MODULE MODD_PARAM - USE MODE_FIELD, ONLY: TYPEUNDEF, TYPEINT, TYPELOG, TYPEREAL, TYPECHAR, TYPEDATE - - IMPLICIT NONE - - CHARACTER(LEN=*), PARAMETER :: VERSION_ID='lfi2cdf Ver. Alpha' - - INTEGER, PARAMETER :: D0 = 100 - INTEGER, PARAMETER :: D1 = 200 - INTEGER, PARAMETER :: D2 = 300 - INTEGER, PARAMETER :: D3 = 400 - - INTEGER, PARAMETER :: NOTFOUND = -1 - - INTEGER, PARAMETER :: FM_FIELD_SIZE = 32 - -END MODULE MODD_PARAM diff --git a/LIBTOOLS/tools/lfi2cdf/src/mode_dimlist.f90 b/LIBTOOLS/tools/lfi2cdf/src/mode_dimlist.f90 deleted file mode 100644 index 26f46ca56d831f584cc381c5d32779061286c613..0000000000000000000000000000000000000000 --- a/LIBTOOLS/tools/lfi2cdf/src/mode_dimlist.f90 +++ /dev/null @@ -1,118 +0,0 @@ -MODULE mode_dimlist - IMPLICIT NONE - - TYPE dimCDFl2c - CHARACTER(LEN=8) :: name - INTEGER :: len - INTEGER :: id - LOGICAL :: create - INTEGER :: ndims ! number of dim reference (when create=.FALSE.) - TYPE(dimCDFl2c), POINTER :: next - END TYPE dimCDFl2c - - TYPE(dimCDFl2c), POINTER, PRIVATE, SAVE :: dimlist - INTEGER, PRIVATE, SAVE :: nbelt = 0 - INTEGER, SAVE :: IDIMX = 0 - INTEGER, SAVE :: IDIMY = 0 - INTEGER, SAVE :: IDIMZ = 0 - LOGICAL, SAVE :: GUSEDIM = .FALSE. - TYPE(dimCDFl2c), POINTER :: ptdimx, ptdimy, ptdimz - -CONTAINS - - SUBROUTINE init_dimCDF() - - NULLIFY(dimlist) - NULLIFY(ptdimx, ptdimy, ptdimz) - IF (GUSEDIM) THEN - ! reservation for DIMX,DIMY,DIMZ - ptdimx=>get_dimCDF(IDIMX,.TRUE.) - ptdimx%name = 'DIMX' - ptdimy=>get_dimCDF(IDIMY,.TRUE.) - ptdimy%name = 'DIMY' - ! PGD MesoNH files doesn't contain KMAX - IF (IDIMZ > 0) THEN - ptdimz=>get_dimCDF(IDIMZ,.TRUE.) - ptdimz%name = 'DIMZ' - END IF - END IF - END SUBROUTINE init_dimCDF - - FUNCTION size_dimCDF() - INTEGER :: size_dimCDF - - size_dimCDF = nbelt - - END FUNCTION size_dimCDF - - FUNCTION first_dimCDF() - TYPE(dimCDFl2c), POINTER :: first_dimCDF - - first_dimCDF=>dimlist - - END FUNCTION first_dimCDF - - - FUNCTION get_dimCDF(len,ocreate) - INTEGER, INTENT(IN) :: len - LOGICAL, INTENT(IN), OPTIONAL :: ocreate ! when .TRUE. create a dim CELL - TYPE(dimCDFl2c), POINTER :: get_dimCDF - - - TYPE(dimCDFl2c), POINTER :: tmp - INTEGER :: count - CHARACTER(LEN=5) :: yndim - LOGICAL :: gforce - - IF (PRESENT(ocreate)) THEN - gforce = ocreate - ELSE - gforce = .FALSE. - ENDIF - ! - IF (len /= 1) THEN - IF (gforce) THEN - count = 0 - NULLIFY(tmp) - ELSE - count = 1 - tmp=>dimlist - DO WHILE(ASSOCIATED(tmp)) - IF (tmp%len == len) EXIT - tmp=>tmp%next - count = count+1 - END DO - END IF - IF (.NOT. ASSOCIATED(tmp)) THEN - ALLOCATE(tmp) - nbelt = nbelt+1 - WRITE(yndim,'(i5)') count - tmp%name = 'DIM'//ADJUSTL(yndim) - tmp%len = len - tmp%id = 0 - IF (GUSEDIM .AND. len == IDIMX*IDIMY) THEN - tmp%create = .FALSE. - tmp%ndims = 2 - ELSEIF (GUSEDIM .AND. len == IDIMX*IDIMY*IDIMZ) THEN - tmp%ndims = 3 - tmp%create = .FALSE. - ELSEIF (GUSEDIM .AND. IDIMY == 3 .AND. len == IDIMX*IDIMZ) THEN - tmp%ndims = 12 ! faux mais reconnu dans def_ncdf - tmp%create = .FALSE. - ELSE - tmp%ndims = 0 - tmp%create = .TRUE. - END IF - tmp%next => dimlist - dimlist => tmp - END IF - - get_dimCDF=>tmp - - ELSE - - NULLIFY(get_dimCDF) - END IF - - END FUNCTION get_dimCDF -END MODULE mode_dimlist diff --git a/LIBTOOLS/tools/lfi2cdf/src/mode_options.f90 b/LIBTOOLS/tools/lfi2cdf/src/mode_options.f90 index 779810c9f4c6f642063244605a114d258e9672d9..18df21389eb7687a7a89ccd4bfc1b84a8b82adbf 100644 --- a/LIBTOOLS/tools/lfi2cdf/src/mode_options.f90 +++ b/LIBTOOLS/tools/lfi2cdf/src/mode_options.f90 @@ -1,5 +1,5 @@ module mode_options - USE MODD_PARAM + USE MODE_FIELD, ONLY: TYPEUNDEF, TYPEINT, TYPELOG, TYPEREAL, TYPECHAR, TYPEDATE implicit none diff --git a/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90 b/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90 index ab26c4a123458de457138cfcc2afb71854c922e7..962ff3d8888ad521bf6421073191c3a76b871eec 100644 --- a/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90 +++ b/LIBTOOLS/tools/lfi2cdf/src/mode_util.f90 @@ -2,13 +2,14 @@ MODULE mode_util USE MODD_IO_ll, ONLY: TFILE_ELT USE MODD_NETCDF, ONLY: DIMCDF, IDCDF_KIND - USE mode_dimlist USE MODE_FIELD USE MODE_FIELDTYPE USE MODE_FMREAD USE MODE_FMWRIT + USE mode_options - USE netcdf + + USE NETCDF IMPLICIT NONE @@ -17,6 +18,8 @@ MODULE mode_util INTEGER,PARAMETER :: MAXFILES=100 INTEGER,PARAMETER :: MAXLFICOMMENTLENGTH=100 + INTEGER,PARAMETER :: FM_FIELD_SIZE = 32 + INTEGER,PARAMETER :: UNDEFINED = -1, READING = 1, WRITING = 2 INTEGER,PARAMETER :: UNKNOWN_FORMAT = -1, NETCDF_FORMAT = 1, LFI_FORMAT = 2 @@ -38,7 +41,6 @@ MODULE mode_util TYPE workfield CHARACTER(LEN=FM_FIELD_SIZE) :: name ! nom du champ - TYPE(dimCDFl2c), POINTER :: dim INTEGER :: id_in = -1, id_out = -1 LOGICAL :: found ! T if found in the input file LOGICAL :: calc ! T if computed from other variables @@ -57,6 +59,10 @@ MODULE mode_util CHARACTER(LEN=6) :: CPROGRAM_ORIG + INTEGER, SAVE :: IDIMX = 0 + INTEGER, SAVE :: IDIMY = 0 + INTEGER, SAVE :: IDIMZ = 0 + CONTAINS FUNCTION str_replace(hstr, hold, hnew) CHARACTER(LEN=*) :: hstr, hold, hnew @@ -73,7 +79,7 @@ CONTAINS END FUNCTION str_replace - SUBROUTINE parse_infiles(infiles, nbvar_infile, nbvar_tbr, nbvar_calc, nbvar_tbw, tpreclist, kbuflen, options, icurrent_level) + SUBROUTINE parse_infiles(infiles, nbvar_infile, nbvar_tbr, nbvar_calc, nbvar_tbw, tpreclist, kbuflen, options) USE MODD_DIM_n, ONLY: NIMAX_ll, NJMAX_ll, NKMAX USE MODD_PARAMETERS, ONLY: JPHEXT, JPVEXT @@ -82,16 +88,14 @@ CONTAINS TYPE(workfield), DIMENSION(:), POINTER :: tpreclist INTEGER, INTENT(OUT) :: kbuflen TYPE(option),DIMENSION(:), INTENT(IN) :: options - INTEGER, INTENT(IN), OPTIONAL :: icurrent_level INTEGER :: ji,jj, kcdf_id, kcdf_id2, itype INTEGER :: ndb, nde, ndey, idx, idx_var, maxvar INTEGER :: idims, idimtmp, jdim, status, var_id LOGICAL :: ladvan - INTEGER :: ich, current_level, leng + INTEGER :: ich, leng INTEGER :: comment_size, fsize, sizemax CHARACTER(LEN=FM_FIELD_SIZE) :: yrecfm, YDATENAME - CHARACTER(LEN=4) :: suffix INTEGER(KIND=8),DIMENSION(:),ALLOCATABLE :: iwork INTEGER :: IID, IRESP INTEGER(KIND=LFI_INT) :: iresp2,ilu,ileng,ipos @@ -113,26 +117,13 @@ CONTAINS IDIMY = NJMAX_ll+2*JPHEXT IDIMZ = NKMAX +2*JPVEXT - GUSEDIM = (IDIMX*IDIMY > 0) - IF (GUSEDIM) THEN - PRINT *,'MESONH 3D, 2D articles DIMENSIONS used :' - PRINT *,'DIMX =',IDIMX - PRINT *,'DIMY =',IDIMY - PRINT *,'DIMZ =',IDIMZ ! IDIMZ may be equal to 0 (PGD files) - ELSE - PRINT *,'BEWARE : ALL MesoNH arrays are handled as 1D arrays !' - END IF + PRINT *,'MESONH 3D, 2D articles DIMENSIONS used :' + PRINT *,'DIMX =',IDIMX + PRINT *,'DIMY =',IDIMY + PRINT *,'DIMZ =',IDIMZ ! IDIMZ may be equal to 0 (PGD files) sizemax = 0 - IF (present(icurrent_level)) THEN - write(suffix,'(I4.4)') icurrent_level - current_level = icurrent_level - ElSE - suffix='' - current_level = -1 - END IF - ! Phase 1 : build articles list to convert. ! ! Pour l'instant tous les articles du fichier LFI sont @@ -211,12 +202,12 @@ CONTAINS yrecfm = TRIM(tpreclist(ji)%name) IF (infiles%files(1)%format == LFI_FORMAT) THEN - CALL LFINFO(iresp2,ilu,trim(yrecfm)//trim(suffix),ileng,ipos) + CALL LFINFO(iresp2,ilu,trim(yrecfm),ileng,ipos) IF (iresp2 == 0 .AND. ileng /= 0) tpreclist(ji)%found = .true. IF (iresp2==0 .AND. ileng == 0 .AND. ipos==0 .AND. infiles%TFILES(1)%TFILE%NSUBFILES_IOZ>0) THEN !Variable not found with no error (iresp2==0 .AND. ileng == 0 .AND. ipos==0) !If we are merging, maybe it is one of the split variable - !In that case, the 1st part of the variable is in the 1st splitted file with a 0001 suffix + !In that case, the 1st part of the variable is in the 1st split file with a 0001 suffix CALL LFINFO(iresp2,infiles%TFILES(1)%TFILE%TFILES_IOZ(1)%TFILE%NLFIFLU,trim(yrecfm)//'0001',ileng,ipos) IF (iresp2 == 0 .AND. ileng /= 0) THEN tpreclist(ji)%found = .true. @@ -230,11 +221,11 @@ CONTAINS leng = ileng ELSE IF (infiles%files(1)%format == NETCDF_FORMAT) THEN - status = NF90_INQ_VARID(kcdf_id,trim(yrecfm)//trim(suffix),tpreclist(ji)%id_in) + status = NF90_INQ_VARID(kcdf_id,trim(yrecfm),tpreclist(ji)%id_in) IF (status /= NF90_NOERR .AND. infiles%TFILES(1)%TFILE%NSUBFILES_IOZ>0) THEN !Variable probably not found (other error possible...) !If we are merging, maybe it is one of the split variable - !In that case, the 1st part of the variable is in the 1st splitted file with a 0001 suffix + !In that case, the 1st part of the variable is in the 1st split file with a 0001 suffix kcdf_id2 = infiles%TFILES(1)%TFILE%TFILES_IOZ(1)%TFILE%NNCID status = NF90_INQ_VARID(kcdf_id2,trim(yrecfm)//'0001',tpreclist(ji)%id_in) IF (status == NF90_NOERR) THEN @@ -267,7 +258,7 @@ CONTAINS END DO IF (tpreclist(ji)%LSPLIT) THEN IF(idims/=2) CALL PRINT_MSG(NVERB_FATAL,'IO','parse_infiles','split variables can only be 3D') - !Split variables are Z-splitted + !Split variables are Z-split leng = leng * IDIMZ END IF END IF @@ -441,7 +432,7 @@ END DO IF (nbvar_calc>0) THEN !Calculated variables - !Done after previous loop to reuse metadate from component variables + !Done after previous loop to reuse metadata from component variables !Derive metadata from its components !If same value for all components => take it !If not => nothing or default value @@ -561,7 +552,6 @@ END DO INTEGER :: idx, ji, nbfiles INTEGER :: kcdf_id INTEGER :: IID, IRESP - TYPE(dimCDFl2c), POINTER :: tzdim INTEGER :: invdims INTEGER :: type_float INTEGER, DIMENSION(10) :: ivdims @@ -588,7 +578,7 @@ END DO END SUBROUTINE def_ncdf - SUBROUTINE fill_ncdf(infiles,outfiles,tpreclist,knaf,kbuflen,options,current_level) + SUBROUTINE fill_ncdf(infiles,outfiles,tpreclist,knaf,kbuflen,options) USE MODD_TYPE_DATE USE MODE_NETCDF, ONLY: IO_GUESS_DIMIDS_NC4 @@ -598,7 +588,6 @@ END DO INTEGER, INTENT(IN) :: knaf INTEGER, INTENT(IN) :: kbuflen TYPE(option),DIMENSION(:), INTENT(IN) :: options - INTEGER, OPTIONAL, INTENT(IN) :: current_level INTEGER(KIND=8),DIMENSION(:),ALLOCATABLE :: iwork INTEGER :: idx, ji,jj @@ -610,7 +599,6 @@ END DO INTEGER :: src INTEGER :: level INTEGER(KIND=LFI_INT) :: iresp,ilu,ileng,ipos - CHARACTER(LEN=4) :: suffix ! INTEGER,DIMENSION(3) :: idims, start INTEGER,DIMENSION(3) :: start INTEGER,DIMENSION(:),ALLOCATABLE :: itab @@ -633,15 +621,6 @@ INTEGER(KIND=IDCDF_KIND),DIMENSION(NF90_MAX_VAR_DIMS) :: IDIMLEN ! IF (infiles%files(1)%format == LFI_FORMAT) ilu = infiles%files(1)%lun_id ! - - IF (present(current_level)) THEN - write(suffix,'(I4.4)') current_level - level = current_level - ElSE - suffix='' - level = 1 - END IF - ALLOCATE(iwork(kbuflen)) ALLOCATE(itab(kbuflen)) ALLOCATE(gtab(kbuflen)) @@ -659,8 +638,8 @@ INTEGER(KIND=IDCDF_KIND),DIMENSION(NF90_MAX_VAR_DIMS) :: IDIMLEN CASE (TYPEINT) IF (infiles%files(1)%format == LFI_FORMAT) THEN IF (.NOT.tpreclist(ji)%calc) THEN - CALL LFINFO(iresp,ilu,trim(tpreclist(ji)%name)//trim(suffix),ileng,ipos) - CALL LFILEC(iresp,ilu,trim(tpreclist(ji)%name)//trim(suffix),iwork,ileng) + CALL LFINFO(iresp,ilu,trim(tpreclist(ji)%name),ileng,ipos) + CALL LFILEC(iresp,ilu,trim(tpreclist(ji)%name),iwork,ileng) extent = ileng - 2 - iwork(2) !iwork(2) = comment length ! Determine TDIMS CALL IO_GUESS_DIMIDS_NC4(outfiles%tfiles(idx)%TFILE,tpreclist(ji)%TFIELD,extent,tpreclist(ji)%TDIMS,IRESP2) @@ -672,8 +651,8 @@ INTEGER(KIND=IDCDF_KIND),DIMENSION(NF90_MAX_VAR_DIMS) :: IDIMLEN itab(1:extent) = iwork(3+iwork(2):3+iwork(2)+extent-1) ELSE src=tpreclist(ji)%src(1) - CALL LFINFO(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),ileng,ipos) - CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),iwork,ileng) + CALL LFINFO(iresp,ilu,trim(tpreclist(src)%name),ileng,ipos) + CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name),iwork,ileng) extent = ileng - 2 - iwork(2) !iwork(2) = comment length itab(1:extent) = iwork(3+iwork(2):3+iwork(2)+extent-1) ! Determine TDIMS @@ -690,7 +669,7 @@ INTEGER(KIND=IDCDF_KIND),DIMENSION(NF90_MAX_VAR_DIMS) :: IDIMLEN jj = 2 DO jj=2,tpreclist(ji)%NSRC src=tpreclist(ji)%src(jj) - CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),iwork,ileng) + CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name),iwork,ileng) !PW: TODO: check same dimensions itab(1:extent) = itab(1:extent) + iwork(3+iwork(2):3+iwork(2)+extent-1) END DO @@ -779,8 +758,8 @@ print *,'PW:TODO' CASE (TYPELOG) IF (infiles%files(1)%format == LFI_FORMAT) THEN IF (.NOT.tpreclist(ji)%calc) THEN - CALL LFINFO(iresp,ilu,trim(tpreclist(ji)%name)//trim(suffix),ileng,ipos) - CALL LFILEC(iresp,ilu,trim(tpreclist(ji)%name)//trim(suffix),iwork,ileng) + CALL LFINFO(iresp,ilu,trim(tpreclist(ji)%name),ileng,ipos) + CALL LFILEC(iresp,ilu,trim(tpreclist(ji)%name),iwork,ileng) extent = ileng - 2 - iwork(2) !iwork(2) = comment length ! Determine TDIMS CALL IO_GUESS_DIMIDS_NC4(outfiles%tfiles(idx)%TFILE,tpreclist(ji)%TFIELD,extent,tpreclist(ji)%TDIMS,IRESP2) @@ -792,8 +771,8 @@ print *,'PW:TODO' itab(1:extent) = iwork(3+iwork(2):3+iwork(2)+extent-1) ELSE src=tpreclist(ji)%src(1) - CALL LFINFO(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),ileng,ipos) - CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),iwork,ileng) + CALL LFINFO(iresp,ilu,trim(tpreclist(src)%name),ileng,ipos) + CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name),iwork,ileng) extent = ileng - 2 - iwork(2) !iwork(2) = comment length ! Determine TDIMS CALL IO_GUESS_DIMIDS_NC4(outfiles%tfiles(idx)%TFILE,tpreclist(src)%TFIELD,extent,tpreclist(src)%TDIMS,IRESP2) @@ -810,7 +789,7 @@ print *,'PW:TODO' jj = 2 DO WHILE (tpreclist(ji)%src(jj)>0 .AND. jj.LE.MAXRAW) src=tpreclist(ji)%src(jj) - CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),iwork,ileng) + CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name),iwork,ileng) !PW: TODO: check same dimensions itab(1:extent) = itab(1:extent) + iwork(3+iwork(2):3+iwork(2)+extent-1) jj=jj+1 @@ -896,8 +875,8 @@ print *,'PW:TODO' IF (infiles%files(1)%format == LFI_FORMAT) THEN IF (.NOT.tpreclist(ji)%calc) THEN IF (.NOT.tpreclist(ji)%LSPLIT) THEN - CALL LFINFO(iresp,ilu,trim(tpreclist(ji)%name)//trim(suffix),ileng,ipos) - CALL LFILEC(iresp,ilu,trim(tpreclist(ji)%name)//trim(suffix),iwork,ileng) + CALL LFINFO(iresp,ilu,trim(tpreclist(ji)%name),ileng,ipos) + CALL LFILEC(iresp,ilu,trim(tpreclist(ji)%name),iwork,ileng) extent = ileng - 2 - iwork(2) !iwork(2) = comment length ! Determine TDIMS CALL IO_GUESS_DIMIDS_NC4(outfiles%tfiles(idx)%TFILE,tpreclist(ji)%TFIELD,extent,tpreclist(ji)%TDIMS,IRESP2) @@ -908,7 +887,7 @@ print *,'PW:TODO' END IF xtab(1:extent) = TRANSFER(iwork(3+iwork(2):),(/ 0.0_8 /)) ELSE - !We assume that splitted variables are always of size(IDIMX,IDMIY,IDIMZ) + !We assume that split variables are always of size(IDIMX,IDMIY,IDIMZ) ALLOCATE(xtab3d(IDIMX,IDIMY,IDIMZ)) CALL IO_READ_FIELD(infiles%tfiles(1)%TFILE,tpreclist(ji)%TFIELD,XTAB3D) extent = IDIMX*IDIMY*IDIMZ @@ -925,8 +904,8 @@ print *,'PW:TODO' ELSE src=tpreclist(ji)%src(1) IF (.NOT.tpreclist(ji)%LSPLIT) THEN - CALL LFINFO(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),ileng,ipos) - CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),iwork,ileng) + CALL LFINFO(iresp,ilu,trim(tpreclist(src)%name),ileng,ipos) + CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name),iwork,ileng) extent = ileng - 2 - iwork(2) !iwork(2) = comment length ! Determine TDIMS CALL IO_GUESS_DIMIDS_NC4(outfiles%tfiles(idx)%TFILE,tpreclist(src)%TFIELD,extent,tpreclist(src)%TDIMS,IRESP2) @@ -943,13 +922,13 @@ print *,'PW:TODO' jj = 2 DO WHILE (tpreclist(ji)%src(jj)>0 .AND. jj.LE.MAXRAW) src=tpreclist(ji)%src(jj) - CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name)//trim(suffix),iwork,ileng) + CALL LFILEC(iresp,ilu,trim(tpreclist(src)%name),iwork,ileng) !PW: TODO: check same dimensions xtab(1:extent) = xtab(1:extent) + TRANSFER(iwork(3+iwork(2):),(/ 0.0_8 /)) jj=jj+1 END DO ELSE !Split variable - !We assume that splitted variables are always of size(IDIMX,IDMIY,IDIMZ) + !We assume that split variables are always of size(IDIMX,IDMIY,IDIMZ) ALLOCATE(xtab3d(IDIMX,IDIMY,IDIMZ)) ALLOCATE(xtab3d2(IDIMX,IDIMY,IDIMZ)) CALL IO_READ_FIELD(infiles%tfiles(1)%TFILE,tpreclist(tpreclist(ji)%src(1))%TFIELD,XTAB3D) @@ -1075,8 +1054,8 @@ END IF CASE (TYPECHAR) IF (ndims/=0) CALL PRINT_MSG(NVERB_FATAL,'IO','fill_ncdf','only ndims=0 is supported for TYPECHAR') IF (infiles%files(1)%format == LFI_FORMAT) THEN - CALL LFINFO(iresp,ilu,trim(tpreclist(ji)%name)//trim(suffix),ileng,ipos) - CALL LFILEC(iresp,ilu,trim(tpreclist(ji)%name)//trim(suffix),iwork,ileng) + CALL LFINFO(iresp,ilu,trim(tpreclist(ji)%name),ileng,ipos) + CALL LFILEC(iresp,ilu,trim(tpreclist(ji)%name),iwork,ileng) extent = ileng - 2 - iwork(2) !iwork(2) = comment length ! ALLOCATE(ytab(extent)) allocate(character(len=extent)::ytab) @@ -1173,76 +1152,10 @@ END DO iwork(2+jj)=ICHAR(tpreclist(ivar)%TFIELD%CCOMMENT(jj:jj)) END DO -stop - -iartlen=2+icomlen+1 -#if 0 - IF (ASSOCIATED(tpreclist(ivar)%dim)) THEN - idlen = tpreclist(ivar)%dim%len - ndims = tpreclist(ivar)%dim%ndims - ELSE - idlen = 1 - ndims = 0 - END IF - - idims(:) = 1 - if(ndims>0) idims(1) = ptdimx%len - if(ndims>1) idims(2) = ptdimy%len - if(ndims>2) idims(3) = ptdimz%len - if(ndims>3) then - PRINT *,'Too many dimensions' - STOP - endif - - iartlen = 2+icomlen+idlen - idata=>iwork(3+icomlen:iartlen) - - - SELECT CASE(tpreclist(ivar)%TFIELD%NTYPE) - CASE(TYPEINT,TYPELOG) - ALLOCATE( itab3d(idims(1),idims(2),idims(3)) ) - status = NF90_GET_VAR(kcdf_id,tpreclist(ivar)%id_in,itab3d) - IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__) - -! PRINT *,'TYPEINT,TYPELOG --> ',tpreclist(ivar)%name,',len = ',idlen - idata(1:idlen) = RESHAPE( itab3d , (/ idims(1)*idims(2)*idims(3) /) ) - - DEALLOCATE(itab3d) - - CASE(TYPEREAL) - ALLOCATE( xtab3d(idims(1),idims(2),idims(3)) ) - status = NF90_GET_VAR(kcdf_id,tpreclist(ivar)%id_in,xtab3d) - IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__) - -! PRINT *,'TYPEREAL --> ',tpreclist(ivar)%name,',len = ',idlen - idata(1:idlen) = RESHAPE( TRANSFER(xtab3d,(/ 0_8 /),idlen) , (/ idims(1)*idims(2)*idims(3) /) ) - - DEALLOCATE(xtab3d) - - CASE(TYPECHAR) - ALLOCATE(ytab(idlen)) - status = NF90_GET_VAR(kcdf_id,tpreclist(ivar)%id_in,ytab) - IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__) - -! PRINT *,'TYPECHAR --> ',tpreclist(ivar)%name,',len = ',idlen - DO jj=1,idlen - idata(jj) = ICHAR(ytab(jj)) - END DO - - DEALLOCATE(ytab) - - CASE default - ALLOCATE( xtab3d(idims(1),idims(2),idims(3)) ) - status = NF90_GET_VAR(kcdf_id,tpreclist(ivar)%id_in,xtab3d) - IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__) - PRINT *,'Default (ERROR) -->',tpreclist(ivar)%name,',len = ',idlen - idata(1:idlen) = RESHAPE( TRANSFER(xtab3d,(/ 0_8 /),idlen) , (/ idims(1)*idims(2)*idims(3) /) ) +stop - DEALLOCATE(xtab3d) - END SELECT -#endif ! Attention restoration des '%' dans le nom des champs LFI yrecfm = str_replace(tpreclist(ivar)%name,'__','%') @@ -1256,34 +1169,6 @@ iartlen=2+icomlen+1 END SUBROUTINE build_lfi - SUBROUTINE UPDATE_VARID_IN(infiles,hinfile,tpreclist,nbvar,current_level) - !Update the id_in for netCDF files (could change from one file to the other) - TYPE(filelist_struct), INTENT(IN) :: infiles - CHARACTER(LEN=*), INTENT(IN) :: hinfile - TYPE(workfield), DIMENSION(:), INTENT(INOUT) :: tpreclist - INTEGER, INTENT(IN) :: nbvar - INTEGER, INTENT(IN) :: current_level - - INTEGER :: ji, status - CHARACTER(len=4) :: suffix - - - if (infiles%files(1)%format /= NETCDF_FORMAT) return - - write(suffix,'(I4.4)') current_level - - DO ji=1,nbvar - IF (.NOT.tpreclist(ji)%tbr) CYCLE - status = NF90_INQ_VARID(infiles%files(1)%lun_id,trim(tpreclist(ji)%name)//trim(suffix),tpreclist(ji)%id_in) - IF (status /= NF90_NOERR .AND. tpreclist(ji)%found) THEN - tpreclist(ji)%found=.false. - tpreclist(ji)%tbr=.false. - tpreclist(ji)%tbw=.false. - print *,'Error: variable ',trim(tpreclist(ji)%name),' not found anymore in split file' - END IF - END DO - END SUBROUTINE UPDATE_VARID_IN - SUBROUTINE OPEN_FILES(infiles,outfiles,hinfile,houtfile,nbvar_infile,options,runmode) USE MODD_CONF, ONLY: LCARTESIAN USE MODD_CONF_n, ONLY: CSTORAGE_TYPE @@ -1450,52 +1335,6 @@ iartlen=2+icomlen+1 END SUBROUTINE OPEN_FILES - SUBROUTINE OPEN_SPLIT_LFIFILE_IN(infiles,hinfile,current_level) - TYPE(filelist_struct), INTENT(INOUT) :: infiles - CHARACTER(LEN=*), INTENT(IN) :: hinfile - INTEGER, INTENT(IN) :: current_level - - INTEGER(KIND=LFI_INT) :: ilu,iresp,iverb,inap,nbvar - - CHARACTER(LEN=3) :: suffix - CHARACTER(LEN=:),ALLOCATABLE :: filename - - - iverb = 0 !Verbosity level for LFI - - ALLOCATE(character(len=len(hinfile)) :: filename) - - ilu = infiles%files(1)%lun_id !We assume only 1 infile - - write(suffix,'(I3.3)') current_level - filename=hinfile(1:len(hinfile)-4)//suffix - CALL LFIOUV(iresp,ilu,ltrue,filename,'OLD',lfalse,lfalse,iverb,inap,nbvar) - infiles%files(1)%opened = .TRUE. - - DEALLOCATE(filename) - END SUBROUTINE OPEN_SPLIT_LFIFILE_IN - - SUBROUTINE OPEN_SPLIT_NCFILE_IN(infiles,hinfile,current_level) - TYPE(filelist_struct), INTENT(INOUT) :: infiles - CHARACTER(LEN=*), INTENT(IN) :: hinfile - INTEGER, INTENT(IN) :: current_level - - INTEGER :: status - CHARACTER(LEN=3) :: suffix - CHARACTER(LEN=:),ALLOCATABLE :: filename - - - ALLOCATE(character(len=len(hinfile)) :: filename) - - write(suffix,'(I3.3)') current_level - filename=hinfile(1:len(hinfile)-4)//suffix - status = NF90_OPEN(filename,NF90_NOWRITE,infiles%files(1)%lun_id) - IF (status /= NF90_NOERR) CALL HANDLE_ERR(status,__LINE__) - infiles%files(1)%opened = .TRUE. - - DEALLOCATE(filename) - END SUBROUTINE OPEN_SPLIT_NCFILE_IN - SUBROUTINE OPEN_SPLIT_NCFILES_OUT(outfiles,houtfile,nbvar,tpreclist,options) USE MODE_FM, ONLY: IO_FILE_OPEN_ll USE MODE_IO_MANAGE_STRUCT, ONLY: IO_FILE_ADD2LIST