testNetCDF_prg Program

program~~testnetcdf_prg~~UsesGraph program~testnetcdf_prg testNetCDF_prg module~kinds_mod kinds_mod module~kinds_mod->program~testnetcdf_prg module~array_mod array_mod module~kinds_mod->module~array_mod module~netcdf_mod netCDF_mod module~kinds_mod->module~netcdf_mod module~array_mod->program~testnetcdf_prg module~netcdf_mod->program~testnetcdf_prg netcdf netcdf netcdf->module~netcdf_mod
Help


Test program for netCFD_mod

Calls

program~~testnetcdf_prg~~CallsGraph program~testnetcdf_prg testNetCDF_prg proc~testwrite testWrite program~testnetcdf_prg->proc~testwrite proc~testread testRead program~testnetcdf_prg->proc~testread interface~writestep writeStep proc~testwrite->interface~writestep proc~meshgridy meshGridY proc~testwrite->proc~meshgridy proc~linspace linspace proc~testwrite->proc~linspace proc~meshgridx meshGridX proc~testwrite->proc~meshgridx proc~writegrid writeGrid proc~testwrite->proc~writegrid proc~testread->proc~meshgridy proc~testread->proc~meshgridx interface~readstep readStep proc~testread->interface~readstep proc~readgrid readGrid proc~testread->proc~readgrid nf90_put_att nf90_put_att proc~writegrid->nf90_put_att nf90_def_var nf90_def_var proc~writegrid->nf90_def_var nf90_def_dim nf90_def_dim proc~writegrid->nf90_def_dim nf90_enddef nf90_enddef proc~writegrid->nf90_enddef nf90_put_var nf90_put_var proc~writegrid->nf90_put_var nf90_create nf90_create proc~writegrid->nf90_create nf90_close nf90_close proc~writegrid->nf90_close proc~readgrid->nf90_close nf90_inquire nf90_inquire proc~readgrid->nf90_inquire nf90_inquire_dimension nf90_inquire_dimension proc~readgrid->nf90_inquire_dimension nf90_inquire_variable nf90_inquire_variable proc~readgrid->nf90_inquire_variable nf90_get_var nf90_get_var proc~readgrid->nf90_get_var nf90_open nf90_open proc~readgrid->nf90_open
Help

Source Code


Subroutines

subroutine testWrite()

Test writing netCDF files

Arguments

None

subroutine testRead()

Test reading netCDF files
May fail due to write failure

Arguments

None

Source Code

program testNetCDF_prg
	!! Test program for netCFD_mod
	use kinds_mod
	use netCDF_mod
	use array_mod
	implicit none
	
	call testWrite
	call testRead
	
contains

	subroutine testWrite
		!! Test writing netCDF files
		real(wp),dimension(:),allocatable::x,y
		real(wp),dimension(:,:),allocatable::XX,YY,F
		
		x = linspace(0.0_wp,1.0_wp,100)
		y = linspace(0.0_wp,1.0_wp,101)
		
		XX = meshGridX(x,y)
		YY = meshGridY(x,y)
		
		F = XX*YY
		
		call writeGrid('data.nc',['F'],x,y)
		call writeStep('data.nc',0.0_wp,1,'F',F)
	end subroutine testWrite

	subroutine testRead
		!! Test reading netCDF files  
		!! May fail due to write failure
		logical,dimension(1)::results
		real(wp),dimension(:),allocatable::x,y,z,t
		real(wp),dimension(:,:),allocatable::XX,YY,F
		character(3),dimension(:),allocatable::vars
		
		call readGrid('data.nc',vars,x,y,z,t)
		allocate(F(size(x),size(y)))
		call readStep('data.nc',trim(adjustl(vars(1))),F,1)
		
		XX = meshGridX(x,y)
		YY = meshGridY(x,y)
		
		results(1) = norm2(F-XX*YY)<1.0E-10_wp
		
		if( .not.any(results) ) error stop "Failed testRead[Write] check"
	end subroutine testRead

end program testNetCDF_prg