http://www.mmm.ucar.edu/wrf/users/user_main.html
This prototype has been tested
on a few platforms. The HDF WRF IO modules should work on any platform that
WRF3.1 and HDF5 support, although the details of the configuration may need
to be worked out.
Module |
Platforms |
Notes |
Sequential |
NCSA IBM P690. NCAR IBM SP3 PC Linux with PGI Fortran 90 Compiler, Vers. 4 SGI IRIX6.5-64 bit |
To date, WRF3.1 does not work on Linux with PGF, version 5. |
Parallel |
NCSA IBM P690. NCAR IBM SP3 |
2. Add WRF-HDF5 IO module(s) to the WRF source
The HDF5 WRF IO modules are added as sub-directories in the 'external' directory of the WRF source.
cd external;
tar xvf io_hdf5.tar
tar xvf io_phdf5.tar
contents of the sequential HDF WRF IO module: ./io_hdf5 ./io_hdf5/wrf-hdf5.F90 ./io_hdf5/wrf_status_codes.h ./io_hdf5/Makefile ./io_hdf5/wrf-hdf5attr.F90 ./io_hdf5/wrf-hdf5support.F90 ./io_hdf5/wrf_io_flags.h |
contents of the sequential HDF WRF IO module: ./io_phdf5/ ./io_phdf5/Makefile ./io_phdf5/wrf_status_codes.h ./io_phdf5/wrf-phdf5attr.F90 ./io_phdf5/wrf-phdf5support.F90 ./io_phdf5/wrf_io_flags.h ./io_phdf5/wrf-phdf5.F90 |
Design note:
In the sequential HDF5 WRF
IO modules, arrays larger thatn 8096 bytes are compressed by default. In
this case, the HDF5 dataset is configured to use the shuffle filter plus deflate
(GZIP) compression, with compression level 6.
In the current prototype, there is no option in the namelist for
users to change this default. To modify this behavior, it is necessary to modify the source code.
To disable compression:
Edit the file 'wrf/external/io_hdf5/wrf-hdf5.F90'
Comment out the lines:
call h5pset_shuffle_f(crp_list,hdf5err)
and
call h5pset_deflate_f(crp_list,6,hdf5err)
To use SZIP compression instead:
For SZIP information and downloads, see the szip at http://hdf.ncsa.uiuc.edu/doc_resource/SZIP/.
Edit the file 'wrf/external/io_hdf5/wrf-hdf5.F90'.
Comment out the lines:
call h5pset_shuffle_f(crp_list,hdf5err)
and
call h5pset_deflate_f(crp_list,6,hdf5err)
Uncomment the line:
call h5pset_szip_f(crp_list,H5_SZIP_AK13_OM_F+H5_SZIP_NN_OM_F,8,hdf5err)
Change the value of the parameters in the function h5pset_szip_f if necessary. See the SZIP documentation for more information about the parameters.
3. Modifications to WRF files
In order to add a new IO module to WRF, several
files in the WRF source code must be changed. The following files need to be
modified:
WRFV1/configure WRFV1/Registry/Registry WRFV1/arch/Config.pl WRFV1/arch/configure.defaults WRFV1/frame/md_calls.m4 WRFV1/frame/module_io.F WRFV1/share/module_io_wrf.F WRFV1/external/Makefile |
Examples of the changes to the files of the WRF1.3 distribution are available at:
ftp://ftp.ncsa.uiuc.edu/HDF/pub/outgoing/wrf-hdf5-modules
WRF configuration files
The 'configure' file must be updated to add the HDF5 and PHDF5 variables.
*** ../WRFV1/configure Thu Feb 6 13:10:56 2003 --- ./WRFV1-with-hdf/configure Thu May 13 12:18:40 2004 *************** *** 206,211 **** --- 206,223 ---- echo "Will configure for use without NetCDF" fi + if [ -n "$HDF5" ] ; then + echo "Will use HDF5 in dir: $HDF5" + else + echo "Will configure for use without HDF5" + fi + + if [ -n "$PHDF5" ] ; then + echo "Will use PHDF5 in dir: $PHDF5" + else + echo "Will configure for use without PHDF5" + fi + # if the uname command exists, give it a shot and see if # we can narrow the choices; otherwise, spam 'em os="ARCH" *************** *** 227,232 **** # Found perl, so proceed with configuration if test -n "$PERL" ; then ! $PERL arch/Config.pl -perl=$PERL -netcdf=$NETCDF -os=$os -mach=$mach fi --- 239,244 ---- # Found perl, so proceed with configuration if test -n "$PERL" ; then ! $PERL arch/Config.pl -perl=$PERL -netcdf=$NETCDF -hdf5=$HDF5 -phdf5=$PHDF5 -os=$os -mach=$mach fi |
The file 'Registry/Registry' must be updated to add the HDF IO modules (io_hdf5 and io_phdf5).
*** ../WRFV1/Registry/Registry Wed Feb 12 09:28:28 2003 --- ./WRFV1-with-hdf/Registry/Registry Thu May 13 12:18:39 2004 *************** *** 738,745 **** # Four placeholders for additional packages (we can go beyond zzz # but that will entail modifying frame/module_io.F and frame/md_calls.m4) # Please note these are placeholders; HDF has not been implemented yet. ! package io_hdf io_form_restart==3 - - ! package io_xxx io_form_restart==4 - - package io_yyy io_form_restart==5 - - package io_zzz io_form_restart==6 - - --- 738,745 ---- # Four placeholders for additional packages (we can go beyond zzz # but that will entail modifying frame/module_io.F and frame/md_calls.m4) # Please note these are placeholders; HDF has not been implemented yet. ! package io_hdf5 io_form_restart==3 - - ! package io_phdf5 io_form_restart==4 - - package io_yyy io_form_restart==5 - - package io_zzz io_form_restart==6 - - |
The file 'arch/Config.pl' needs to be changed to add the code to use the HDF5 and PHDF5 variables.
*** ../WRFV1/arch/Config.pl Fri Mar 16 12:06:46 2001 --- ./WRFV1-with-hdf/arch/Config.pl Thu May 13 12:18:37 2004 *************** *** 7,12 **** --- 7,14 ---- $sw_perl_path = perl ; $sw_netcdf_path = "" ; + $sw_hdf5_path =""; + $sw_phdf5_path=""; $sw_os = "ARCH" ; # ARCH will match any $sw_mach = "ARCH" ; # ARCH will match any *************** *** 20,25 **** --- 22,35 ---- { $sw_netcdf_path = substr( $ARGV[0], 8 ) ; } + if ( substr( $ARGV[0], 1, 5 ) eq "hdf5=" ) + { + $sw_hdf5_path = substr( $ARGV[0], 6 ) ; + } + if ( substr( $ARGV[0], 1, 6 ) eq "phdf5=" ) + { + $sw_phdf5_path = substr( $ARGV[0], 7 ) ; + } if ( substr( $ARGV[0], 1, 3 ) eq "os=" ) { $sw_os = substr( $ARGV[0], 4 ) ; *************** *** 89,94 **** --- 99,106 ---- { $_ =~ s/CONFIGURE_PERL_PATH/$sw_perl_path/g ; $_ =~ s/CONFIGURE_NETCDF_PATH/$sw_netcdf_path/g ; + $_ =~ s/CONFIGURE_HDF5_PATH/$sw_hdf5_path/g ; + $_ =~ s/CONFIGURE_PHDF5_PATH/$sw_phdf5_path/g ; if ( $sw_netcdf_path ) { $_ =~ s/CONFIGURE_WRFIO_NF/wrfio_nf/g ; $_ =~ s:CONFIGURE_NETCDF_FLAG:-DNETCDF: ; *************** *** 99,104 **** --- 111,140 ---- $_ =~ s:CONFIGURE_NETCDF_FLAG::g ; $_ =~ s:CONFIGURE_NETCDF_LIB_PATH::g ; } + + if ( $sw_hdf5_path ) + + { $_ =~ s/CONFIGURE_WRFIO_HDF5/wrfio_hdf5/g ; + $_ =~ s:CONFIGURE_HDF5_FLAG:-DHDF5: ; + $_ =~ s:CONFIGURE_HDF5_LIB_PATH:-L../external/io_hdf5 -lwrfio_hdf5 -L$sw_hdf5_path/lib -lhdf5_fortran -lhdf5 -lm -lz -L$sw_hdf5_path/lib -lsz: ; + } + else + { $_ =~ s/CONFIGURE_WRFIO_HDF5//g ; + $_ =~ s:CONFIGURE_HDF5_FLAG::g ; + $_ =~ s:CONFIGURE_HDF5_LIB_PATH::g ; + } + + if ( $sw_phdf5_path ) + + { $_ =~ s/CONFIGURE_WRFIO_PHDF5/wrfio_phdf5/g ; + $_ =~ s:CONFIGURE_PHDF5_FLAG:-DPHDF5: ; + $_ =~ s:CONFIGURE_PHDF5_LIB_PATH:-L../external/io_phdf5 -lwrfio_phdf5 -L$sw_phdf5_path/lib -lhdf5_fortran -lhdf5 -lm -lz: ; + } + else + { $_ =~ s/CONFIGURE_WRFIO_PHDF5//g ; + $_ =~ s:CONFIGURE_PHDF5_FLAG::g ; + $_ =~ s:CONFIGURE_PHDF5_LIB_PATH::g ; + } @machopts = ( @machopts, $_ ) ; } if ( substr( $_, 0, 5 ) eq "#ARCH" && $latchon == 0 ) |
The file 'arch/configure.defauts' must be edited to reflect the configuration of the current system.
*** ../WRFV1/arch/configure.defaults Fri Mar 28 14:08:48 2003 --- ./WRFV1-with-hdf/arch/configure.defaults Thu May 13 12:18:40 2004 *************** *** 732,758 **** ########################################################### ! #ARCH AIX DM (RSL-IO, IBM-MPI) # DMPARALLEL = 1 ! SFC = xlf90_r SCC = xlc_r ! FC = mpxlf90_r CC = mpcc_r CFLAGS = -DNOUNDERSCORE -DWRF_RSL_IO -I../external/RSL/RSL -DDM_PARALLEL \ -DMAXDOM_MAKE=$(MAX_DOMAINS) -DMAXPROC_MAKE=$(MAX_PROC) ! FCOPTIM = -O2 -qarch=auto -qmaxmem=32676 FCDEBUG = # -g -qfullpath FCBASEOPTS = -qspill=20000 $(FCDEBUG) FCFLAGS = $(FCOPTIM) $(FCBASEOPTS) ! INCLUDE_MODULES = -I../external/io_netcdf -I../external/io_int \ -I../frame -I../share -I../phys -I../inc EXTRAMODULES = ARCHFLAGS = -DWRF_RSL_IO -DRSL -DDM_PARALLEL -DIWORDSIZE=4 -DRWORDSIZE=4 \ ! -DLWORDSIZE=4 CONFIGURE_NETCDF_FLAG -DTRIEDNTRUE -DONLY_WRFMODEL_IO -DINTIO PERL = perl REGISTRY = Registry ! LIB = CONFIGURE_NETCDF_LIB_PATH -L../external/RSL/RSL -lrsl -lmass \ -L../external/io_int -lwrfio_int \ ../frame/internal_header_util.o ../frame/pack_utils.o LDFLAGS = -bmaxstack:256000000 --- 732,823 ---- ########################################################### ! #ARCH AIX DM (RSL-IO, IBM-MPI)(PARALLEL HDF5) # DMPARALLEL = 1 ! SFC = xlf90_r SCC = xlc_r ! FC = mpxlf90_r CC = mpcc_r CFLAGS = -DNOUNDERSCORE -DWRF_RSL_IO -I../external/RSL/RSL -DDM_PARALLEL \ -DMAXDOM_MAKE=$(MAX_DOMAINS) -DMAXPROC_MAKE=$(MAX_PROC) ! FCOPTIM = -O1 -qarch=auto -qmaxmem=-1 ! #FCOPTIM = -O2 ! FCDEBUG = -g -qfullpath ! FCBASEOPTS = -qspill=20000 $(FCDEBUG) ! FCFLAGS = $(FCOPTIM) $(FCBASEOPTS) ! INCLUDE_MODULES = -I../external/io_netcdf -I../external/io_phdf5 -I../external/io_int \ ! -I../frame -I../share -I../phys -I../inc ! EXTRAMODULES = ! ARCHFLAGS = -DWRF_RSL_IO -DRSL -DDM_PARALLEL -DIWORDSIZE=4 -DRWORDSIZE=4 \ ! -DLWORDSIZE=4 CONFIGURE_NETCDF_FLAG CONFIGURE_PHDF5_FLAG -DTRIEDNTRUE -DONLY_WRFMODEL_IO -DINTIO ! PERL = perl ! REGISTRY = Registry ! LIB = CONFIGURE_NETCDF_LIB_PATH CONFIGURE_PHDF5_LIB_PATH -L../external/RSL/RSL -lrsl -lmass \ ! -L../external/io_int -lwrfio_int \ ! ../frame/internal_header_util.o ../frame/pack_utils.o ! LDFLAGS = -bmaxstack:256000000 -bmaxdata:0x80000000 ! CPP = /lib/cpp ! CPPFLAGS = -I$(LIBINCLUDE) -C -P $(ARCHFLAGS) -I../external/RSL/RSL `cat ../inc/dm_comm_cpp_flags` ! MAX_DOMAINS = 4 ! MAX_PROC = 1024 ! AR = ar ru ! M4 = m4 -B 8000 ! RANLIB = ranlib ! ! externals : CONFIGURE_WRFIO_NF CONFIGURE_WRFIO_PHDF5 ../external/RSL/RSL/librsl.a wrfio_int ! ( /bin/cp ../tools/gen_comms_warning ../tools/gen_comms.c ; cat ../external/RSL/gen_comms.c >> ../tools/gen_comms.c ; \ ! /bin/cp module_dm_warning module_dm.F ; cat ../external/RSL/module_dm.F >> module_dm.F ) ! ! wrfio_nf : ! ( cd ../external/io_netcdf ; make NETCDFPATH=CONFIGURE_NETCDF_PATH FC="$(SFC) $(FCDEBUG) -qarch=auto -qzerosize" ; /bin/cp wrf_io_flags.h wrf_status_codes.h ../../inc ) ! ! wrfio_phdf5 : ! ( cd ../external/io_phdf5 ; make PHDF5PATH=CONFIGURE_PHDF5_PATH FC="$(FC) $(FCDEBUG) -qarch=auto -qfree=F90 -qzerosize" ; /bin/cp wrf_io_flags.h wrf_status_codes.h ../../inc ) ! ! wrfio_int : ! ( cd ../external/io_int ; \ ! make CC=$(CC) FC="$(SFC) $(FCDEBUG) -qarch=auto -qzerosize" all diffwrf ) ! ! ../external/RSL/RSL/librsl.a : ! ( cd ../external/RSL/RSL ; make MAX_DOMAINS=$(MAX_DOMAINS) MAX_PROC=$(MAX_PROC) LEARN_BCAST=-DLEARN_BCAST sp2 ) ! ! # compile these without high optimization to speed compile ! mediation_force_domain.o : mediation_force_domain.F ! mediation_interp_domain.o : mediation_interp_domain.F ! ! mediation_force_domain.o \ ! mediation_interp_domain.o : ! $(RM) $@ ! sed /\!.\*\'/s/\'//g $*.F > $*.b ! $(CPP) -I../inc $(CPPFLAGS) $*.b > $*.f ! $(RM) $*.b ! $(FC) -c $(FCBASEOPTS) $(MODULE_DIRS) $*.f ! ! ########################################################### ! #ARCH AIX DM (RSL-IO, IBM-MPI)(SERIAL HDF5) ! # ! DMPARALLEL = 1 ! SFC = xlf90_r ! SCC = xlc_r ! FC = mpxlf90_r ! CC = mpcc_r ! CFLAGS = -DNOUNDERSCORE -DWRF_RSL_IO -I../external/RSL/RSL -DDM_PARALLEL \ ! -DMAXDOM_MAKE=$(MAX_DOMAINS) -DMAXPROC_MAKE=$(MAX_PROC) ! FCOPTIM = -O1 -qarch=auto -qmaxmem=32676 ! #FCOPTIM = -O2 FCDEBUG = # -g -qfullpath FCBASEOPTS = -qspill=20000 $(FCDEBUG) FCFLAGS = $(FCOPTIM) $(FCBASEOPTS) ! INCLUDE_MODULES = -I../external/io_netcdf -I../external/io_hdf5 -I../external/io_int \ -I../frame -I../share -I../phys -I../inc EXTRAMODULES = ARCHFLAGS = -DWRF_RSL_IO -DRSL -DDM_PARALLEL -DIWORDSIZE=4 -DRWORDSIZE=4 \ ! -DLWORDSIZE=4 CONFIGURE_NETCDF_FLAG CONFIGURE_HDF5_FLAG -DTRIEDNTRUE -DONLY_WRFMODEL_IO -DINTIO PERL = perl REGISTRY = Registry ! LIB = CONFIGURE_NETCDF_LIB_PATH CONFIGURE_HDF5_LIB_PATH \ ! -L../external/RSL/RSL -lrsl -lmass \ -L../external/io_int -lwrfio_int \ ../frame/internal_header_util.o ../frame/pack_utils.o LDFLAGS = -bmaxstack:256000000 *************** *** 764,776 **** M4 = m4 -B 8000 RANLIB = ranlib ! externals : CONFIGURE_WRFIO_NF ../external/RSL/RSL/librsl.a wrfio_int ( /bin/cp ../tools/gen_comms_warning ../tools/gen_comms.c ; cat ../external/RSL/gen_comms.c >> ../tools/gen_comms.c ; \ /bin/cp module_dm_warning module_dm.F ; cat ../external/RSL/module_dm.F >> module_dm.F ) wrfio_nf : ( cd ../external/io_netcdf ; make NETCDFPATH=CONFIGURE_NETCDF_PATH FC="$(SFC) $(FCDEBUG) -qarch=auto -qzerosize" ; /bin/cp wrf_io_flags.h wrf_status_codes.h ../../inc ) wrfio_int : ( cd ../external/io_int ; \ make CC=$(CC) FC="$(SFC) $(FCDEBUG) -qarch=auto -qzerosize" all diffwrf ) --- 829,844 ---- M4 = m4 -B 8000 RANLIB = ranlib ! externals : CONFIGURE_WRFIO_NF CONFIGURE_WRFIO_HDF5 ../external/RSL/RSL/librsl.a wrfio_int ( /bin/cp ../tools/gen_comms_warning ../tools/gen_comms.c ; cat ../external/RSL/gen_comms.c >> ../tools/gen_comms.c ; \ /bin/cp module_dm_warning module_dm.F ; cat ../external/RSL/module_dm.F >> module_dm.F ) wrfio_nf : ( cd ../external/io_netcdf ; make NETCDFPATH=CONFIGURE_NETCDF_PATH FC="$(SFC) $(FCDEBUG) -qarch=auto -qzerosize" ; /bin/cp wrf_io_flags.h wrf_status_codes.h ../../inc ) + wrfio_hdf5 : + ( cd ../external/io_hdf5 ; make HDF5PATH=CONFIGURE_HDF5_PATH FC="$(SFC) $(FCDEBUG) -qarch=auto -qfree=F90 -qzerosize" ; /bin/cp wrf_io_flags.h wrf_status_codes.h ../../inc ) + wrfio_int : ( cd ../external/io_int ; \ make CC=$(CC) FC="$(SFC) $(FCDEBUG) -qarch=auto -qzerosize" all diffwrf ) *************** *** 1650,1663 **** FCBASEOPTS = -byteswapio -Ktrap=fp -Mfree -tp p6 $(FCDEBUG) FCFLAGS = $(FCOPTIM) $(FCBASEOPTS) ARCHFLAGS = -DDEREF_KLUDGE -DIO_DEREF_KLUDGE -DIWORDSIZE=4 -DRWORDSIZE=4 -DLWORDSIZE=4 \ ! CONFIGURE_NETCDF_FLAG \ -DTRIEDNTRUE -DONLY_WRFMODEL_IO ! INCLUDE_MODULES = -module ../main -I../external/io_netcdf -I../external/io_int \ -I../frame -I../share -I../phys -I../inc EXTRAMODULES = PERL = perl REGISTRY = Registry ! LIB = CONFIGURE_NETCDF_LIB_PATH \ ../frame/internal_header_util.o ../frame/pack_utils.o LDFLAGS = CPP = /lib/cpp --- 1718,1731 ---- FCBASEOPTS = -byteswapio -Ktrap=fp -Mfree -tp p6 $(FCDEBUG) FCFLAGS = $(FCOPTIM) $(FCBASEOPTS) ARCHFLAGS = -DDEREF_KLUDGE -DIO_DEREF_KLUDGE -DIWORDSIZE=4 -DRWORDSIZE=4 -DLWORDSIZE=4 \ ! CONFIGURE_NETCDF_FLAG CONFIGURE_HDF5_FLAG\ -DTRIEDNTRUE -DONLY_WRFMODEL_IO ! INCLUDE_MODULES = -module ../main -I../external/io_netcdf -I../external/io_hdf5 -I../external/io_int \ -I../frame -I../share -I../phys -I../inc EXTRAMODULES = PERL = perl REGISTRY = Registry ! LIB = CONFIGURE_NETCDF_LIB_PATH CONFIGURE_HDF5_LIB_PATH \ ../frame/internal_header_util.o ../frame/pack_utils.o LDFLAGS = CPP = /lib/cpp *************** *** 1666,1672 **** M4 = m4 RANLIB = ranlib ! externals : CONFIGURE_WRFIO_NF wrfio_int ( /bin/cp module_dm_warning module_dm.F ; cat module_dm_stubs.F >> module_dm.F ) wrfio_nf : --- 1734,1740 ---- M4 = m4 RANLIB = ranlib ! externals : CONFIGURE_WRFIO_NF CONFIGURE_WRFIO_HDF5 wrfio_int ( /bin/cp module_dm_warning module_dm.F ; cat module_dm_stubs.F >> module_dm.F ) wrfio_nf : *************** *** 1675,1680 **** --- 1743,1754 ---- FFLAGS='$(FCFLAGS) -ICONFIGURE_NETCDF_PATH/include' ; \ /bin/cp wrf_io_flags.h wrf_status_codes.h ../../inc ) + wrfio_hdf5 : + ( cd ../external/io_hdf5 ; \ + make HDF5PATH=CONFIGURE_HDF5_PATH FC=$(FC) TRADFLAG="-traditional" \ + FFLAGS='$(FCFLAGS) -ICONFIGURE_HDF5_PATH/lib' ; \ + /bin/cp wrf_io_flags.h wrf_status_codes.h ../../inc ) + wrfio_int : ( cd ../external/io_int ; \ make CC=$(CC) FC="$(SFC) $(FCDEBUG) $(FCBASEOPTS)" \ |
Modifications of source code inside WRF
The io_hdf5 and/or io_phdf5 modules must be added to the WRF source. In addition, the WRF source must be modified in a few places.
The 'frame/md_calls.m4' must be modified to recognize the HDF modules.
*** ../WRFV1/frame/md_calls.m4 Mon Dec 10 18:10:43 2001 --- ./WRFV1-with-hdf/frame/md_calls.m4 Thu May 13 12:18:44 2004 *************** *** 70,78 **** CALL wrf_dm_bcast_bytes( Status, IWORDSIZE ) ENDIF #endif ! #ifdef HDF ! CASE ( IO_HDF ) ! CALL ext_hdf_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) #endif #ifdef XXX --- 70,99 ---- CALL wrf_dm_bcast_bytes( Status, IWORDSIZE ) ENDIF #endif ! #ifdef HDF5 ! CASE ( IO_HDF5 ) ! IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN ! CALL ext_hdf5_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ! ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) ! ENDIF ! IF ( .NOT. multi_files(io_form) ) THEN ! ifelse($1,get,ifelse($3,integer,`CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )')) ! ifelse($1,get,ifelse($3,integer,`CALL wrf_dm_bcast_bytes( Data, IWORDSIZE*locCount )')) ! ifelse($1,get,ifelse($3,real, `CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )')) ! ifelse($1,get,ifelse($3,real, `CALL wrf_dm_bcast_bytes( Data, RWORDSIZE*locCount )')) ! ifelse($1,get,ifelse($3,logical,`CALL wrf_dm_bcast_bytes( locCount, IWORDSIZE )')) ! ifelse($1,get,ifelse($3,logical,`CALL wrf_dm_bcast_bytes( Data, LWORDSIZE*locCount )')) ! ifelse($1,get,ifelse($4,char, `len_of_str = LEN(Data)')) ! ifelse($1,get,ifelse($4,char, `CALL wrf_dm_bcast_bytes( len_of_str, IWORDSIZE )')) ! ifelse($1,get,ifelse($4,char, `CALL wrf_dm_bcast_string( Data, len_of_str )')) ! CALL wrf_dm_bcast_bytes( Status, IWORDSIZE ) ! ENDIF ! ! ! #endif ! #ifdef PHDF5 ! CASE ( IO_PHDF5 ) ! CALL ext_phdf5_$1_$2_$6_$3$4 ( Hndl, Element, ifelse($6,td,`DateStr,') ifelse($2,var,`Varname,') Data, & ifelse($4,char,,`locCount, ifelse($1,get,`Outcount,')') Status ) #endif #ifdef XXX |
The 'frame/module_io.F' file must be modified to add code to call the HDF5 modules if selected.
*** ../WRFV1/frame/module_io.F Tue Dec 3 14:10:48 2002 --- ./WRFV1-with-hdf/frame/module_io.F Thu May 13 12:18:45 2004 *************** *** 34,39 **** --- 34,48 ---- #ifdef NETCDF CALL ext_ncd_ioinit( SysDepInfo, Status ) #endif + + #ifdef HDF5 + CALL ext_hdf5_ioinit(SysDepInfo, Status) + #endif + + #ifdef PHDF5 + CALL ext_phdf5_ioinit(SysDepInfo, Status) + #endif + END SUBROUTINE wrf_ioinit !--- ioexit *************** *** 47,52 **** --- 56,70 ---- #ifdef NETCDF CALL ext_ncd_ioexit( Status ) #endif + + #ifdef HDF5 + CALL ext_hdf5_ioexit(Status) + #endif + + #ifdef PHDF5 + CALL ext_phdf5_ioexit(Status) + #endif + IF ( use_output_servers() ) CALL ext_quilt_ioexit( Status ) END SUBROUTINE *************** *** 134,139 **** --- 152,179 ---- CALL ext_hdf_open_for_write_begin ( FileName , Comm_compute, Comm_io, SysDepInfo, & Hndl , Status ) #endif + #ifdef HDF5 + CASE ( IO_HDF5 ) + IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN + IF ( multi_files(io_form) ) THEN + CALL wrf_get_myproc ( myproc ) + CALL append_to_filename ( LocFilename , FileName , myproc, 4 ) + ELSE + LocFilename = FileName + ENDIF + CALL ext_hdf5_open_for_write_begin ( LocFileName , Comm_compute, Comm_io, SysDepInfo, & + Hndl , Status ) + ENDIF + IF ( .NOT. multi_files(io_form) ) THEN + CALL wrf_dm_bcast_bytes( Hndl, IWORDSIZE ) + CALL wrf_dm_bcast_bytes( Status, IWORDSIZE ) + ENDIF + #endif + #ifdef PHDF5 + CASE ( IO_PHDF5 ) + CALL ext_phdf5_open_for_write_begin ( FileName , Comm_compute, Comm_io, SysDepInfo, & + Hndl , Status ) + #endif #ifdef XXX CASE ( IO_XXX ) CALL ext_xxx_open_for_write_begin ( FileName , Comm_compute, Comm_io, SysDepInfo, & *************** *** 214,219 **** --- 254,270 ---- CASE ( IO_HDF ) CALL ext_hdf_open_for_write_commit ( Hndl , Status ) #endif + #ifdef HDF5 + CASE ( IO_HDF5 ) + IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN + CALL ext_hdf5_open_for_write_commit ( Hndl , Status ) + ENDIF + IF ( .NOT. multi_files(io_form) ) CALL wrf_dm_bcast_bytes( Status, IWORDSIZE ) + #endif + #ifdef PHDF5 + CASE ( IO_PHDF5 ) + CALL ext_phdf5_open_for_write_commit ( Hndl , Status ) + #endif #ifdef XXX CASE ( IO_XXX ) CALL ext_xxx_open_for_write_commit ( Hndl , Status ) *************** *** 316,321 **** --- 367,388 ---- CALL ext_hdf_open_for_read ( FileName , Comm_compute, Comm_io, SysDepInfo, & Hndl , Status ) #endif + #ifdef HDF5 + CASE ( IO_HDF5 ) + IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) THEN + CALL ext_hdf5_open_for_read ( FileName , Comm_compute, Comm_io, SysDepInfo, & + Hndl , Status ) + ENDIF + IF ( .NOT. multi_files(io_form) ) THEN + CALL wrf_dm_bcast_bytes( Status, IWORDSIZE ) + CALL wrf_dm_bcast_bytes( Hndl, IWORDSIZE ) + ENDIF + #endif + #ifdef PHDF5 + CASE ( IO_PHDF5 ) + CALL ext_phdf5_open_for_read ( FileName , Comm_compute, Comm_io, SysDepInfo, & + Hndl , Status ) + #endif #ifdef XXX CASE ( IO_XXX ) CALL ext_xxx_open_for_read ( FileName , Comm_compute, Comm_io, SysDepInfo, & *************** *** 420,425 **** --- 487,502 ---- CASE ( IO_HDF ) CALL ext_hdf_inquire_opened ( Hndl, FileName , FileStatus, Status ) #endif + #ifdef HDF5 + CASE ( IO_HDF5 ) + IF (wrf_dm_on_monitor()) CALL ext_hdf5_inquire_opened ( Hndl, FileName , FileStatus, Status ) + CALL wrf_dm_bcast_bytes( FileStatus, IWORDSIZE ) + CALL wrf_dm_bcast_bytes( Status , IWORDSIZE ) + #endif + #ifdef PHDF5 + CASE ( IO_PHDF5 ) + CALL ext_phdf5_inquire_opened ( Hndl, FileName , FileStatus, Status ) + #endif #ifdef XXX CASE ( IO_XXX ) CALL ext_xxx_inquire_opened ( Hndl, FileName , FileStatus, Status ) *************** *** 486,491 **** --- 563,578 ---- CASE ( IO_HDF ) CALL ext_hdf_inquire_filename ( Hndl, FileName , FileStatus, Status ) #endif + #ifdef HDF5 + CASE ( IO_HDF5 ) + IF (wrf_dm_on_monitor()) CALL ext_hdf5_inquire_filename ( Hndl, FileName , FileStatus, Status ) + CALL wrf_dm_bcast_bytes( FileStatus, IWORDSIZE ) + CALL wrf_dm_bcast_bytes( Status , IWORDSIZE ) + #endif + #ifdef PHDF5 + CASE ( IO_PHDF5 ) + CALL ext_phdf5_inquire_filename ( Hndl, FileName , FileStatus, Status ) + #endif #ifdef XXX CASE ( IO_XXX ) CALL ext_xxx_inquire_filename ( Hndl, FileName , FileStatus, Status ) *************** *** 607,612 **** --- 694,708 ---- CASE ( IO_HDF ) CALL ext_ncd_ioclose( Hndl, Status ) #endif + #ifdef HDF5 + CASE ( IO_HDF5 ) + IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) CALL ext_hdf5_ioclose( Hndl, Status ) + CALL wrf_dm_bcast_bytes( Status, IWORDSIZE ) + #endif + #ifdef PHDF5 + CASE ( IO_PHDF5 ) + CALL ext_phdf5_ioclose( Hndl, Status ) + #endif #ifdef XXX CASE ( IO_XXX ) CALL ext_xxx_ioclose( Hndl, Status ) *************** *** 675,680 **** --- 771,790 ---- CASE ( IO_HDF ) CALL ext_hdf_get_next_time( Hndl, DateStr, Status ) #endif + #ifdef HDF5 + CASE ( IO_HDF5 ) + IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) CALL ext_hdf5_get_next_time( Hndl, DateStr, Status ) + IF ( .NOT. multi_files(io_form) ) THEN + CALL wrf_dm_bcast_bytes( Status, IWORDSIZE ) + len_of_str = LEN(DateStr) + CALL wrf_dm_bcast_bytes( len_of_str, IWORDSIZE ) + CALL wrf_dm_bcast_string ( DateStr , len_of_str ) + ENDIF + #endif + #ifdef PHDF5 + CASE ( IO_PHDF5 ) + CALL ext_phdf5_get_next_time( Hndl, DateStr, Status ) + #endif #ifdef XXX CASE ( IO_XXX ) CALL ext_xxx_get_next_time( Hndl, DateStr, Status ) *************** *** 742,747 **** --- 852,866 ---- CASE ( IO_HDF ) CALL ext_hdf_set_time( Hndl, DateStr, Status ) #endif + #ifdef HDF5 + CASE ( IO_HDF5 ) + IF ( multi_files(io_form) .OR. wrf_dm_on_monitor() ) CALL ext_hdf5_set_time( Hndl, DateStr, Status ) + CALL wrf_dm_bcast_bytes( Status, IWORDSIZE ) + #endif + #ifdef PHDF5 + CASE ( IO_PHDF5 ) + CALL ext_phdf5_set_time( Hndl, DateStr, Status ) + #endif #ifdef XXX CASE ( IO_XXX ) CALL ext_xxx_set_time( Hndl, DateStr, Status ) *************** *** 875,880 **** --- 994,1002 ---- #ifdef HDF EXTERNAL ext_hdf_read_field #endif + #ifdef HDF5 + EXTERNAL ext_hdf5_read_field + #endif #ifdef XXX EXTERNAL ext_xxx_read_field #endif *************** *** 911,916 **** --- 1033,1058 ---- PatchStart , PatchEnd , & Status ) #endif + #ifdef HDF5 + CASE ( IO_HDF5 ) + CALL call_pkg_and_dist ( ext_hdf5_read_field, multi_files(io_form), & + Hndl , DateStr , VarName , Field , FieldType , Comm , IOComm , & + DomainDesc , bdy_mask, MemoryOrder , Stagger , DimNames , & + DomainStart , DomainEnd , & + MemoryStart , MemoryEnd , & + PatchStart , PatchEnd , & + Status ) + #endif + #ifdef PHDF5 + CASE (IO_PHDF5) + CALL ext_phdf5_read_field ( & + Hndl , DateStr , VarName , Field , FieldType , Comm , IOComm , & + DomainDesc , MemoryOrder , Stagger , DimNames , & + DomainStart , DomainEnd , & + MemoryStart , MemoryEnd , & + PatchStart , PatchEnd , & + Status ) + #endif #ifdef XXX CASE ( IO_XXX ) CALL call_pkg_and_dist ( ext_xxx_read_field, multi_files(io_form), & *************** *** 994,999 **** --- 1136,1144 ---- #ifdef HDF EXTERNAL ext_hdf_write_field #endif + #ifdef HDF5 + EXTERNAL ext_hdf5_write_field + #endif #ifdef XXX EXTERNAL ext_xxx_write_field #endif *************** *** 1028,1033 **** --- 1173,1198 ---- PatchStart , PatchEnd , & Status ) #endif + #ifdef HDF5 + CASE ( IO_HDF5 ) + CALL collect_fld_and_call_pkg ( ext_hdf5_write_field, multi_files(io_form), & + Hndl , DateStr , VarName , Field , FieldType , Comm , IOComm , & + DomainDesc , bdy_mask, MemoryOrder , Stagger , DimNames , & + DomainStart , DomainEnd , & + MemoryStart , MemoryEnd , & + PatchStart , PatchEnd , & + Status ) + #endif + #ifdef PHDF5 + CASE ( IO_PHDF5 ) + CALL ext_phdf5_write_field ( & + Hndl , DateStr , VarName , Field , FieldType , Comm , IOComm , & + DomainDesc , MemoryOrder , Stagger , DimNames , & + DomainStart , DomainEnd , & + MemoryStart , MemoryEnd , & + PatchStart , PatchEnd , & + Status ) + #endif #ifdef XXX CASE ( IO_XXX ) CALL collect_fld_and_call_pkg ( ext_xxx_write_field, multi_files(io_form), & *************** *** 1115,1120 **** --- 1280,1293 ---- DomainStart , DomainEnd , & Status ) #endif + #ifdef HDF5 + CASE ( IO_HDF5 ) + write(*,*) "NOT IMPLEMENT at HDF5" + ! CALL ext_hdf5_get_var_info ( Hndl , VarName , NDim , & + ! MemoryOrder , Stagger , & + ! DomainStart , DomainEnd , & + ! Status ) + #endif #ifdef XXX CASE ( IO_XXX ) CALL ext_xxx_get_var_info ( Hndl , VarName , NDim , & |
The 'share/module_io.F' file must be modified to recognize the HDF5 options for IO.
*** ../WRFV1/share/module_io_wrf.F Tue Feb 18 14:26:22 2003 --- ./WRFV1-with-hdf/share/module_io_wrf.F Thu May 13 12:18:46 2004 *************** *** 1032,1037 **** --- 1032,1079 ---- ,Status ) ENDIF + IF (io_form .EQ. IO_HDF5) THEN + CALL wrf_put_var_ti_char( & + DataHandle & ! DataHandle + ,"description" & ! Element + ,Var & ! Data Name + ,Desc & ! Data + ,Status ) + CALL wrf_put_var_ti_char( & + DataHandle & ! DataHandle + ,"units" & ! Element + ,Var & ! Data Name + ,Units & ! Data + ,Status ) + CALL wrf_put_var_ti_char( & + DataHandle & ! DataHandle + ,"stagger" & ! Element + ,Var & ! Data Name + ,Stagger & ! Data 4/ Build WRF + ,Status ) + ENDIF + + IF (io_form .EQ. IO_PHDF5) THEN + CALL wrf_put_var_ti_char( & + DataHandle & ! DataHandle + ,"description" & ! Element + ,Var & ! Data Name + ,Desc & ! Data + ,Status ) + CALL wrf_put_var_ti_char( & + DataHandle & ! DataHandle + ,"units" & ! Element + ,Var & ! Data Name + ,Units & ! Data + ,Status ) + CALL wrf_put_var_ti_char( & + DataHandle & ! DataHandle + ,"stagger" & ! Element + ,Var & ! Data Name + ,Stagger & ! Data + ,Status ) + ENDIF + IF ( wrf_at_debug_level(300) ) THEN WRITE(wrf_err_message,*) debug_message,' Status = ',Status CALL wrf_message ( TRIM(wrf_err_message) ) |
The 'Makefile' for the 'external' directory must be updated to build the new IO modules.
*** ../WRFV1/external/Makefile Mon Dec 10 18:07:21 2001 --- ./WRFV1-with-hdf/external/Makefile Thu May 13 12:18:38 2004 *************** *** 3,12 **** ( cd RSL/RSL ; make clean ) ( cd io_netcdf ; make clean ) ( cd io_int ; make clean ) superclean : clean /bin/rm -f RSL/RSL/librsl.a RSL/RSL/rsl.inc /bin/rm -f io_netcdf/libwrfio_nf.a io_netcdf/diffwrf io_netcdf/*.o io_netcdf/*.f \ io_int/libwrfio_int.a io_int/diffwrf */*.mod ! ! --- 3,14 ---- ( cd RSL/RSL ; make clean ) ( cd io_netcdf ; make clean ) ( cd io_int ; make clean ) + (cd io_hdf5; make clean) + (cd io_phdf5; make clean) superclean : clean /bin/rm -f RSL/RSL/librsl.a RSL/RSL/rsl.inc /bin/rm -f io_netcdf/libwrfio_nf.a io_netcdf/diffwrf io_netcdf/*.o io_netcdf/*.f \ io_int/libwrfio_int.a io_int/diffwrf */*.mod ! /bin/rm -f io_phdf5/*.a io_phdf5/*.o *.f *.mod ! /bin/rm -f io_hdf5/*.a io_hdf5/*.o *.f *.mod |
Last Modified: 17 May 2004