Changeset 2364 for branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/IOIPSL
- Timestamp:
- 2010-11-05T16:22:12+01:00 (14 years ago)
- Location:
- branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/IOIPSL/src
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/nemo_v3_3_beta/NEMOGCM/EXTERNAL/IOIPSL/src/histcom.f90
r2281 r2364 7 7 !- 8 8 USE netcdf 9 USE nc4dummy ! needed to allow compilation with netcdf3 libraries 9 10 !- 10 11 USE stringop, ONLY : nocomma,cmpblank,findpos,find_str,strlowercase … … 35 36 !- to describe the grid, just two vectors. 36 37 !--------------------------------------------------------------------- 38 !- 39 TYPE, PUBLIC :: snc4_ctl !: netcdf4 chunking control structure 40 !: (optional on histbeg and histend calls) 41 SEQUENCE 42 INTEGER :: ni 43 INTEGER :: nj 44 INTEGER :: nk 45 LOGICAL :: luse 46 END TYPE snc4_ctl 37 47 !- 38 48 INTERFACE histbeg … … 163 173 & (pfilename,pim,plon,pjm,plat, & 164 174 & par_orix,par_szx,par_oriy,par_szy, & 165 & pitau0,pdate0,pdeltat,phoriid,idf,domain_id,mode )175 & pitau0,pdate0,pdeltat,phoriid,idf,domain_id,mode,snc4chunks) 166 176 !--------------------------------------------------------------------- 167 177 !- histbeg for 1D regular horizontal coordinates (see histb_all) … … 179 189 INTEGER,INTENT(IN),OPTIONAL :: domain_id 180 190 CHARACTER(LEN=*),OPTIONAL,INTENT(IN) :: mode 191 TYPE(snc4_ctl), OPTIONAL,INTENT(IN) :: snc4chunks 181 192 !--------------------------------------------------------------------- 182 193 CALL histb_all & … … 184 195 & x_1d=plon,y_1d=plat, & 185 196 & k_orx=par_orix,k_szx=par_szx,k_ory=par_oriy,k_szy=par_szy, & 186 & domain_id=domain_id,mode=mode )197 & domain_id=domain_id,mode=mode,snc4chunks=snc4chunks) 187 198 !------------------------- 188 199 END SUBROUTINE histb_reg1d … … 191 202 & (pfilename,pim,plon,pjm,plat, & 192 203 & par_orix,par_szx,par_oriy,par_szy, & 193 & pitau0,pdate0,pdeltat,phoriid,idf,domain_id,mode )204 & pitau0,pdate0,pdeltat,phoriid,idf,domain_id,mode,snc4chunks) 194 205 !--------------------------------------------------------------------- 195 206 !- histbeg for 2D regular horizontal coordinates (see histb_all) … … 206 217 INTEGER,INTENT(IN),OPTIONAL :: domain_id 207 218 CHARACTER(LEN=*),OPTIONAL,INTENT(IN) :: mode 219 TYPE(snc4_ctl), OPTIONAL,INTENT(IN) :: snc4chunks 208 220 !--------------------------------------------------------------------- 209 221 CALL histb_all & … … 211 223 & x_2d=plon,y_2d=plat, & 212 224 & k_orx=par_orix,k_szx=par_szx,k_ory=par_oriy,k_szy=par_szy, & 213 & domain_id=domain_id,mode=mode )225 & domain_id=domain_id,mode=mode,snc4chunks=snc4chunks) 214 226 !------------------------- 215 227 END SUBROUTINE histb_reg2d … … 217 229 SUBROUTINE histb_irreg & 218 230 & (pfilename,pim,plon,plon_bounds,plat,plat_bounds, & 219 & pitau0,pdate0,pdeltat,phoriid,idf,domain_id,mode )231 & pitau0,pdate0,pdeltat,phoriid,idf,domain_id,mode,snc4chunks) 220 232 !--------------------------------------------------------------------- 221 233 !- histbeg for irregular horizontal coordinates (see histb_all) … … 232 244 INTEGER,INTENT(IN),OPTIONAL :: domain_id 233 245 CHARACTER(LEN=*),OPTIONAL,INTENT(IN) :: mode 246 TYPE(snc4_ctl), OPTIONAL,INTENT(IN) :: snc4chunks 234 247 !--------------------------------------------------------------------- 235 248 CALL histb_all & 236 249 & (3,pfilename,pim,pim,pitau0,pdate0,pdeltat,phoriid,idf, & 237 250 & x_1d=plon,y_1d=plat,x_bnds=plon_bounds,y_bnds=plat_bounds, & 238 & domain_id=domain_id,mode=mode )251 & domain_id=domain_id,mode=mode,snc4chunks=snc4chunks) 239 252 !------------------------- 240 253 END SUBROUTINE histb_irreg … … 243 256 & (k_typ,nc_name,pim,pjm,pitau0,pdate0,pdeltat,phoriid,idf, & 244 257 & x_1d,y_1d,x_2d,y_2d,k_orx,k_szx,k_ory,k_szy, & 245 & x_bnds,y_bnds,domain_id,mode )258 & x_bnds,y_bnds,domain_id,mode,snc4chunks) 246 259 !--------------------------------------------------------------------- 247 260 !- General interface for horizontal grids. … … 305 318 !- Keywords "NETCDF4" and "CLASSIC" are reserved 306 319 !- for future use. 320 !- 321 !- snc4chunks : Structure containing chunk partitioning parameters 322 !- for 4-D variables and a logical switch to toggle 323 !- between netcdf3 o/p (false) and netcdf4 chunked 324 !- and compressed o/p (true) 307 325 !--------------------------------------------------------------------- 308 326 IMPLICIT NONE … … 320 338 INTEGER,INTENT(IN),OPTIONAL :: domain_id 321 339 CHARACTER(LEN=*),OPTIONAL,INTENT(IN) :: mode 340 TYPE(snc4_ctl), OPTIONAL,INTENT(IN) :: snc4chunks 322 341 !- 323 342 INTEGER :: nfid,iret,m_c … … 406 425 ELSE 407 426 m_c = IOR(NF90_CLOBBER,NF90_64BIT_OFFSET) 427 ENDIF 428 !- 429 IF (PRESENT(snc4chunks)) THEN 430 IF (snc4chunks%luse) m_c = NF90_HDF5 ! will conflict if compiling with netcdf4 libraries without "key_netcdf4" 408 431 ENDIF 409 432 !- … … 1347 1370 END SUBROUTINE histdef 1348 1371 !=== 1349 SUBROUTINE histend (idf )1372 SUBROUTINE histend (idf, snc4chunks) 1350 1373 !--------------------------------------------------------------------- 1351 1374 !- This subroutine end the decalaration of variables and sets the … … 1362 1385 !- 1363 1386 INTEGER,INTENT(IN) :: idf 1387 TYPE(snc4_ctl), OPTIONAL,INTENT(IN) :: snc4chunks 1364 1388 !- 1365 1389 INTEGER :: nfid,nvid,iret,ndim,iv,itx,ziv,itax,dim_cnt … … 1378 1402 LOGICAL :: l_b 1379 1403 LOGICAL :: l_dbg 1404 INTEGER, DIMENSION(4) :: ichunksz ! NETCDF4 chunk sizes 1405 INTEGER :: ichunkalg, ishuffle,& 1406 ideflate, ideflate_level 1407 LOGICAL :: lchunk = .FALSE. ! logical switch to activate chunking when appropriate 1408 !- 1409 ! NetCDF4 chunking and compression parameters 1410 ichunkalg = 0 1411 ishuffle = 1 1412 ideflate = 1 1413 ideflate_level = 1 1414 ! 1380 1415 !--------------------------------------------------------------------- 1381 1416 CALL ipsldbg (old_status=l_dbg) … … 1517 1552 & W_F(idf)%W_V(iv)%v_typ,dims(1:ABS(ndim)),nvid) 1518 1553 !- 1554 IF( ndim == 4 ) THEN 1555 IF( PRESENT( snc4chunks ) ) THEN 1556 IF( snc4chunks%luse ) THEN 1557 ichunksz = 1 1558 iret = NF90_INQUIRE_DIMENSION( nfid, W_F(idf)%xid, len = ichunksz(1) ) 1559 iret = NF90_INQUIRE_DIMENSION( nfid, W_F(idf)%yid, len = ichunksz(2) ) 1560 IF ( ziv .NE. -99 ) & 1561 iret = NF90_INQUIRE_DIMENSION( nfid, W_F(idf)%zax_ids(ziv), len = ichunksz(3) ) 1562 ichunksz(1) = MIN(ichunksz(1), MAX((ichunksz(1)-1)/snc4chunks%ni + 1,16)) 1563 ichunksz(2) = MIN(ichunksz(2), MAX((ichunksz(2)-1)/snc4chunks%nj + 1,16)) 1564 ichunksz(3) = MIN(ichunksz(3), MAX((ichunksz(3)-1)/snc4chunks%nk + 1, 1)) 1565 ! Always use a chunk size of 1 for the unlimited dimension 1566 iret = NF90_DEF_VAR_CHUNKING(nfid, nvid, ichunkalg, ichunksz) ! will conflict if compiling with netcdf4 libraries without "key_netcdf4" 1567 1568 iret = NF90_DEF_VAR_DEFLATE(nfid, nvid, ishuffle, ideflate, ideflate_level) ! will conflict if compiling with netcdf4 libraries without "key_netcdf4" 1569 1570 ENDIF 1571 ENDIF 1572 ENDIF 1519 1573 W_F(idf)%W_V(iv)%ncvid = nvid 1520 1574 !-
Note: See TracChangeset
for help on using the changeset viewer.