Skip to content

Commit

Permalink
Merge pull request #426 from kafitzgerald/v5.1.1_io_update
Browse files Browse the repository at this point in the history
V5.1.1 IO update
  • Loading branch information
rcabell authored Nov 15, 2019
2 parents f875a99 + 0cf9f11 commit 3b7a386
Show file tree
Hide file tree
Showing 25 changed files with 85 additions and 278 deletions.
14 changes: 3 additions & 11 deletions trunk/NDHMS/Land_models/Noah/IO_code/module_hrldas_netcdf_io.F
Original file line number Diff line number Diff line change
Expand Up @@ -1413,11 +1413,7 @@ subroutine prepare_output_file(outdir, version, iz0tlnd, sfcdif_option, ucmcall,
iret = nf90_create(trim(output_flnm), &
OR(NF90_CLOBBER, NF90_NETCDF4), ncid, comm=MPI_COMM_WORLD, info=MPI_INFO_NULL)
#else
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf90_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf90_create(trim(output_flnm), NF90_CLOBBER, ncid)
#endif
iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
#endif
call error_handler(iret, failure="Problem nf90_create for "//trim(output_flnm))

Expand Down Expand Up @@ -1859,14 +1855,10 @@ subroutine prepare_restart_file(outdir, version, iz0tlnd, sfcdif_option, ucmcall
ierr = nf90_create(trim(output_flnm), &
OR(NF90_CLOBBER, NF90_NETCDF4), ncid, comm=MPI_COMM_WORLD, info=MPI_INFO_NULL)
#else
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
ierr = nf90_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
ierr = nf90_create(trim(output_flnm), NF90_CLOBBER, ncid)
#endif
ierr = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
#endif
if (ierr /= 0) stop "Problem nf_create"
if (ierr /= 0) stop "Problem nf90_create"
ierr = nf90_def_dim(ncid, "Time", NF90_UNLIMITED, dimid_times)
ierr = nf90_def_dim(ncid, "DateStrLen", 19, dimid_datelen)
Expand Down
14 changes: 3 additions & 11 deletions trunk/NDHMS/Land_models/NoahMP/IO_code/module_hrldas_netcdf_io.F
Original file line number Diff line number Diff line change
Expand Up @@ -2215,11 +2215,7 @@ subroutine prepare_output_file_seq(outdir, version, igrid, &
iret = nf90_create(trim(output_flnm), &
OR(NF90_CLOBBER, NF90_NETCDF4), ncid, comm=MPI_COMM_WORLD, info=MPI_INFO_NULL)
#else
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf90_create(trim(output_flnm), NF90_CLOBBER, ncid)
#endif
iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
#endif
call error_handler(iret, failure="Problem nf90_create for "//trim(output_flnm))

Expand Down Expand Up @@ -2859,15 +2855,11 @@ subroutine prepare_restart_file_seq(outdir, version, igrid, llanduse, olddate, s
ierr = nf90_create(trim(output_flnm), &
OR(NF90_CLOBBER, NF90_NETCDF4), ncid, comm=MPI_COMM_WORLD, info=MPI_INFO_NULL)
#else
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
ierr = nf_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
ierr = nf90_create(trim(output_flnm), NF90_CLOBBER, ncid)
#endif
ierr = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
#endif
if (ierr /= 0) stop "FATAL ERROR: In module_hrldas_netcdf_io.F"// &
" prepare_restart_file_seq() - Problem nf_create"
" prepare_restart_file_seq() - Problem nf90_create"
ierr = nf90_def_dim(ncid, "Time", NF90_UNLIMITED, dimid_times)
ierr = nf90_def_dim(ncid, "DateStrLen", 19, dimid_datelen)
Expand Down
180 changes: 47 additions & 133 deletions trunk/NDHMS/Routing/module_HYDRO_io.F
Original file line number Diff line number Diff line change
Expand Up @@ -1879,15 +1879,9 @@ subroutine output_rt(igrid, split_output_count, ixrt, jxrt, nsoil, &
#ifdef HYDRO_D
print*, 'output_flnm = "'//trim(output_flnm)//'"'
#endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
write(6,*) "using large netcdf file for RTOUT_DOMAIN"
iret = nf_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
write(6,*) "using normal netcdf file for RTOUT_DOMAIN"
iret = nf_create(trim(output_flnm), NF_CLOBBER, ncid)
#endif
iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
if (iret /= 0) then
call hydro_stop("In output_rt() - Problem nf_create")
call hydro_stop("In output_rt() - Problem nf90_create")
endif
iret = nf_def_dim(ncid, "time", NF_UNLIMITED, dimid_times)
Expand Down Expand Up @@ -2377,15 +2371,10 @@ subroutine output_gw_spinup(igrid, split_output_count, ixrt, jxrt, &
#endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf_create(trim(output_flnm), NF_CLOBBER, ncid)
#endif
iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
if (iret /= 0) then
call hydro_stop("In output_gw_spinup() - Problem nf_create")
endif
call hydro_stop("In output_gw_spinup() - Problem nf90_create")
endif
iret = nf_def_dim(ncid, "time", NF_UNLIMITED, dimid_times)
iret = nf_def_dim(ncid, "x", ixrtd, dimid_ix) !-- make a decimated grid
Expand Down Expand Up @@ -2722,14 +2711,9 @@ subroutine sub_output_gw(igrid, split_output_count, ixrt, jxrt, nsoil, &
#endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf_create(trim(output_flnm), NF_CLOBBER, ncid)
#endif
iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
if (iret /= 0) then
call hydro_stop("In output_gw_spinup() - Problem nf_create")
call hydro_stop("In output_gw_spinup() - Problem nf90_create")
endif
iret = nf_def_dim(ncid, "time", NF_UNLIMITED, dimid_times)
Expand Down Expand Up @@ -3153,23 +3137,15 @@ subroutine output_chrt(igrid, split_output_count, NLINKS, ORDER, &
print*, 'output_flnm = "'//trim(output_flnm)//'"'
#endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf_create(trim(output_flnm), NF_CLOBBER, ncid)
#endif
iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
if (iret /= 0) then
call hydro_stop("In output_chrt() - Problem nf_create points")
endif
call hydro_stop("In output_chrt() - Problem nf90_create points")
endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(output_flnm2), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid2)
#else
iret = nf_create(trim(output_flnm2), NF_CLOBBER, ncid2)
#endif
iret = nf90_create(trim(output_flnm2), OR(NF90_CLOBBER, NF90_NETCDF4), ncid2)
if (iret /= 0) then
call hydro_stop("In output_chrt() - Problem nf_create observation")
endif
call hydro_stop("In output_chrt() - Problem nf90_create observation")
endif
do i=1,nlk
if(ORDER(i) .ge. order_to_write) then
Expand Down Expand Up @@ -3921,23 +3897,15 @@ subroutine output_chrt_bak(igrid, split_output_count, NLINKS, ORDER,
print*, 'output_flnm = "'//trim(output_flnm)//'"'
#endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf_create(trim(output_flnm), NF_CLOBBER, ncid)
#endif
if (iret /= 0) then
call hydro_stop("In output_chrt() - Problem nf_create points")
endif
iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
if (iret /= 0) then
call hydro_stop("In output_chrt() - Problem nf90_create points")
endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(output_flnm2), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid2)
#else
iret = nf_create(trim(output_flnm2), NF_CLOBBER, ncid2)
#endif
if (iret /= 0) then
call hydro_stop("In output_chrt() - Problem nf_create observation")
endif
iret = nf90_create(trim(output_flnm2), OR(NF90_CLOBBER, NF90_NETCDF4), ncid2)
if (iret /= 0) then
call hydro_stop("In output_chrt() - Problem nf90_create observation")
endif
do i=1,nlk
if(ORDER(i) .ge. order_to_write) then
Expand Down Expand Up @@ -4846,15 +4814,10 @@ subroutine output_lakes(igrid, split_output_count, NLAKES, &
print*, 'output_flnm = "'//trim(output_flnm)//'"'
#endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf_create(trim(output_flnm), NF_CLOBBER, ncid)
#endif
iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
if (iret /= 0) then
call hydro_stop("In output_lakes() - Problem nf_create")
endif
call hydro_stop("In output_lakes() - Problem nf90_create")
endif
do i=1,NLAKES
station_id(i) = i
Expand Down Expand Up @@ -5085,15 +5048,9 @@ subroutine output_lakes2(igrid, split_output_count, NLAKES, &
print*, 'output_flnm = "'//trim(output_flnm)//'"'
#endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf_create(trim(output_flnm), NF_CLOBBER, ncid)
#endif
iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
if (iret /= 0) then
print*, "Problem nf_create"
call hydro_stop("output_lakes")
call hydro_stop("In output_lakes() - Problem nf90_create")
endif
iret = nf_def_dim(ncid, "station", nlakes, stationdim)
Expand Down Expand Up @@ -5308,15 +5265,10 @@ subroutine output_chrtgrd(igrid, split_output_count, ixrt,jxrt, &


!--- define dimension
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf_create(trim(output_flnm), NF_CLOBBER, ncid)
#endif

iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
if (iret /= 0) then
call hydro_stop("In output_chrtgrd() - Problem nf_create ")
endif
call hydro_stop("In output_chrtgrd() - Problem nf90_create")
endif

iret = nf_def_dim(ncid, "time", NF_UNLIMITED, timedim)
iret = nf_def_dim(ncid, "x", ixrt, ixlondim)
Expand Down Expand Up @@ -5685,18 +5637,14 @@ subroutine output_lsm(outFile,did)
if(IO_id.eq.my_id) &
#endif

#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(outFile), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf_create(trim(outFile), NF_CLOBBER, ncid)
#endif
iret = nf90_create(trim(outFile), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)

#ifdef MPP_LAND
call mpp_land_bcast_int1(iret)
#endif

if (iret /= 0) then
call hydro_stop("In output_lsm() - Problem nf_create")
call hydro_stop("In output_lsm() - Problem nf90_create")
endif


Expand Down Expand Up @@ -5787,27 +5735,14 @@ subroutine RESTART_OUT_nc(outFile,did)
if(IO_id.eq.my_id) &
#endif

#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(outFile), ior(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#ifdef HYDRO_D
write(6,*) "yyywww using large netcdf file definition. "
call flush(6)
#endif
#else
iret = nf_create(trim(outFile), NF_CLOBBER, ncid)
#ifdef HYDRO_D
write(6,*) "yyywww do not use large netcdf file definition. "
call flush(6)
#endif
#endif

iret = nf90_create(trim(outFile), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)

#ifdef MPP_LAND
call mpp_land_bcast_int1(iret)
#endif

if (iret /= 0) then
call hydro_stop("In RESTART_OUT_nc() - Problem nf_create")
call hydro_stop("In RESTART_OUT_nc() - Problem nf90_create")
endif

#ifdef MPP_LAND
Expand Down Expand Up @@ -8816,12 +8751,9 @@ subroutine outPutChanInfo(fromNode,toNode,chlon,chlat)
real, dimension(:) :: chlat,chlon
integer :: iret, nodes, i, ncid, dimid_n, varid
nodes = size(chlon,1)
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create("nodeInfor.nc", IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf_create("nodeInfor.nc", NF_CLOBBER, ncid)
#endif
nodes = size(chlon,1)
iret = nf90_create("nodeInfor.nc", OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
iret = nf_def_dim(ncid, "node", nodes, dimid_n) !-- make a decimated grid
! define the varialbes
iret = nf_def_var(ncid,"fromNode",NF_INT,1,(/dimid_n/),varid)
Expand Down Expand Up @@ -9638,15 +9570,11 @@ subroutine output_chrt2(igrid, split_output_count, NLINKS, ORDER, &
print*, 'output_flnm = "'//trim(output_flnm)//'"'
#endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf_create(trim(output_flnm), NF_CLOBBER, ncid)
#endif
if (iret /= 0) then
print*, "Problem nf_create points"
call hydro_stop("In output_chrt2() - Problem nf_create points.")
endif
iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
if (iret /= 0) then
print*, "Problem nf90_create points"
call hydro_stop("In output_chrt2() - Problem nf90_create points.")
endif
iret = nf_def_dim(ncid, "station", nstations, stationdim)
iret = nf_def_dim(ncid, "time", 1, timedim)
Expand Down Expand Up @@ -10072,14 +10000,10 @@ subroutine output_gw_netcdf(igrid, split_output_count, nbasns, &
print*, 'output_flnm = "'//trim(output_flnm)//'"'
#endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(output_flnm), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf_create(trim(output_flnm), NF_CLOBBER, ncid)
#endif
iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
if (iret /= 0) then
print*, "Problem nf_create"
print*, "Problem nf90_create"
call hydro_stop("output_gw_netcdf")
endif
Expand Down Expand Up @@ -10807,16 +10731,10 @@ subroutine output_lake_types( inNLINKS, inLINKID, inTYPEL )
flush(6)
#endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
write(6,*) "using large netcdf file for LAKE TYPES"
iret = nf_create(trim(output_flnm), ior(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
write(6,*) "using normal netcdf file for LAKE TYPES"
iret = nf_create(trim(output_flnm), NF_CLOBBER, ncid)
#endif
iret = nf90_create(trim(output_flnm), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
if (iret /= 0) then
print*,"Lakes: Problem nf_create"
print*,"Lakes: Problem nf90_create"
call hydro_stop("output_lake_types")
endif
Expand Down Expand Up @@ -10881,17 +10799,13 @@ subroutine hdtbl_out_nc(did,ncid,count,count_flag,varName,varIn,descrip,ixd,jxd)
#ifdef MPP_LAND
if(my_id .eq. IO_id) then
#endif
#ifdef WRFIO_NCD_LARGE_FILE_SUPPORT
iret = nf_create(trim(nlst_rt(did)%hydrotbl_f), IOR(NF_CLOBBER,NF_64BIT_OFFSET), ncid)
#else
iret = nf_create(trim(nlst_rt(did)%hydrotbl_f), NF_CLOBBER, ncid)
#endif
iret = nf90_create(trim(nlst_rt(did)%hydrotbl_f), OR(NF90_CLOBBER, NF90_NETCDF4), ncid)
#ifdef MPP_LAND
endif
call mpp_land_bcast_int1(iret)
#endif
if (iret /= 0) then
call hydro_stop("FATAL ERROR: - Problem nf_create in nc of hydrotab_f file")
call hydro_stop("FATAL ERROR: - Problem nf90_create in nc of hydrotab_f file")
endif
#ifdef MPP_LAND
Expand Down
Loading

0 comments on commit 3b7a386

Please sign in to comment.