ROMS
Loading...
Searching...
No Matches
mod_pio_netcdf::pio_netcdf_get_ivar Interface Reference

Public Member Functions

subroutine pio_netcdf_get_ivar_0d (ng, model, ncname, myvarname, a, piofile, start, total)
 
subroutine pio_netcdf_get_ivar_1d (ng, model, ncname, myvarname, a, piofile, start, total)
 
subroutine pio_netcdf_get_ivar_2d (ng, model, ncname, myvarname, a, piofile, start, total)
 

Detailed Description

Definition at line 66 of file mod_pio_netcdf.F.

Member Function/Subroutine Documentation

◆ pio_netcdf_get_ivar_0d()

subroutine mod_pio_netcdf::pio_netcdf_get_ivar::pio_netcdf_get_ivar_0d ( integer, intent(in) ng,
integer, intent(in) model,
character (len=*), intent(in) ncname,
character (len=*), intent(in) myvarname,
integer, intent(out) a,
type (file_desc_t), intent(in), optional piofile,
integer, dimension(:), intent(in), optional start,
integer, dimension(:), intent(in), optional total )

Definition at line 5150 of file mod_pio_netcdf.F.

5152!
5153!=======================================================================
5154! !
5155! This routine reads requested integer scalar variable from specified !
5156! NetCDF file. !
5157! !
5158! On Input: !
5159! !
5160! ng Nested grid number (integer) !
5161! model Calling model identifier (integer) !
5162! ncname NetCDF file name (string) !
5163! myVarName Variable name (string) !
5164! pioFile PIO file descriptor, TYPE(File_desc_t), OPTIONAL !
5165! pioFile%fh file handler !
5166! pioFile%iosystem IO system descriptor (struct) !
5167! start Starting index where the first of the data values !
5168! will be read along each dimension (integer, !
5169! OPTIONAL) !
5170! total Number of data values to be read along each !
5171! dimension (integer, OPTIONAL) !
5172! !
5173! On Ouput: !
5174! !
5175! A Read scalar variable (integer) !
5176! !
5177! Examples: !
5178! !
5179! CALL pio_netcdf_get_ivar (ng, iNLM, 'f.nc', 'VarName', A) !
5180! CALL pio_netcdf_get_ivar (ng, iNLM, 'f.nc', 'VarName', A(1)) !
5181! !
5182!=======================================================================
5183!
5184! Imported variable declarations.
5185!
5186 integer, intent(in) :: ng, model
5187
5188 integer, intent(in), optional :: start(:)
5189 integer, intent(in), optional :: total(:)
5190!
5191 character (len=*), intent(in) :: ncname
5192 character (len=*), intent(in) :: myVarName
5193!
5194 integer, intent(out) :: A
5195!
5196 TYPE (File_desc_t), intent(in), optional :: pioFile
5197!
5198! Local variable declarations.
5199!
5200 integer :: status
5201
5202 integer, dimension(1) :: my_A
5203!
5204 character (len=*), parameter :: MyFile = &
5205 & __FILE__//", pio_netcdf_get_ivar_0d"
5206!
5207 TYPE (File_desc_t) :: my_pioFile
5208 TYPE (Var_desc_t) :: my_pioVar
5209!
5210!-----------------------------------------------------------------------
5211! Read in an integer scalar variable.
5212!-----------------------------------------------------------------------
5213!
5214! If file descriptor is not provided, open NetCDF for reading.
5215!
5216 IF (.not.PRESENT(piofile)) THEN
5217 CALL pio_netcdf_open (ng, model, trim(ncname), 0, my_piofile)
5218 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5219 ELSE
5220 my_piofile=piofile
5221 END IF
5222!
5223! Read in variable.
5224!
5225 status=pio_inq_varid(my_piofile, trim(myvarname), my_piovar)
5226 IF (status.eq.pio_noerr) THEN
5227 IF (PRESENT(start).and.PRESENT(total)) THEN
5228 status=pio_get_var(my_piofile, my_piovar, start, total, my_a)
5229 a=my_a(1)
5230 ELSE
5231 status=pio_get_var(my_piofile, my_piovar, a)
5232 END IF
5233 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
5234 IF (master) WRITE (stdout,10) trim(myvarname), trim(ncname), &
5235 & trim(sourcefile)
5236 exit_flag=2
5237 ioerror=status
5238 END IF
5239 ELSE
5240 IF (master) WRITE (stdout,20) trim(myvarname), trim(ncname), &
5241 & trim(sourcefile)
5242 exit_flag=2
5243 ioerror=status
5244 END IF
5245!
5246! If file descriptor is not provided, close input NetCDF file.
5247!
5248 IF (.not.PRESENT(piofile)) THEN
5249 CALL pio_netcdf_close (ng, model, my_piofile, ncname, .false.)
5250 END IF
5251!
5252 10 FORMAT (/,' PIO_NETCDF_GET_IVAR_0D - error while reading ', &
5253 & 'variable:',2x,a,/,26x,'in input file:',2x,a, &
5254 & /,26x,'call from:',2x,a)
5255 20 FORMAT (/,' PIO_NETCDF_GET_IVAR_0D - error while inquiring ', &
5256 & 'descriptor for variable:',2x,a, &
5257 & /,26x,'in input file:',2x,a,/,26x,'call from:',2x,a)
5258!
5259 RETURN

References mod_scalars::exit_flag, strings_mod::founderror(), mod_iounits::ioerror, mod_parallel::master, mod_scalars::noerror, mod_pio_netcdf::pio_netcdf_close(), mod_pio_netcdf::pio_netcdf_open(), mod_iounits::sourcefile, and mod_iounits::stdout.

Here is the call graph for this function:

◆ pio_netcdf_get_ivar_1d()

subroutine mod_pio_netcdf::pio_netcdf_get_ivar::pio_netcdf_get_ivar_1d ( integer, intent(in) ng,
integer, intent(in) model,
character (len=*), intent(in) ncname,
character (len=*), intent(in) myvarname,
integer, dimension(:), intent(out) a,
type (file_desc_t), intent(in), optional piofile,
integer, dimension(:), intent(in), optional start,
integer, dimension(:), intent(in), optional total )

Definition at line 5262 of file mod_pio_netcdf.F.

5264!
5265!=======================================================================
5266! !
5267! This routine reads requested integer 1D-array variable from !
5268! specified NetCDF file. !
5269! !
5270! On Input: !
5271! !
5272! ng Nested grid number (integer) !
5273! model Calling model identifier (integer) !
5274! ncname NetCDF file name (string) !
5275! myVarName Variable name (string) !
5276! pioFile PIO file descriptor, TYPE(File_desc_t), OPTIONAL !
5277! pioFile%fh file handler !
5278! pioFile%iosystem IO system descriptor (struct) !
5279! start Starting index where the first of the data values !
5280! will be read along each dimension (integer, !
5281! OPTIONAL) !
5282! total Number of data values to be read along each !
5283! dimension (integer, OPTIONAL) !
5284! !
5285! On Ouput: !
5286! !
5287! A Read 1D-array variable (integer) !
5288! !
5289! Examples: !
5290! !
5291! CALL pio_netcdf_get_ivar (ng, iNLM, 'f.nc', 'VarName', A) !
5292! CALL pio_netcdf_get_ivar (ng, iNLM, 'f.nc', 'VarName', A(0:)) !
5293! CALL pio_netcdf_get_ivar (ng, iNLM, 'f.nc', 'VarName', A(:,1)) !
5294! !
5295!=======================================================================
5296!
5297! Imported variable declarations.
5298!
5299 integer, intent(in) :: ng, model
5300
5301 integer, intent(in), optional :: start(:)
5302 integer, intent(in), optional :: total(:)
5303!
5304 character (len=*), intent(in) :: ncname
5305 character (len=*), intent(in) :: myVarName
5306!
5307 integer, intent(out) :: A(:)
5308!
5309 TYPE (File_desc_t), intent(in), optional :: pioFile
5310!
5311! Local variable declarations.
5312!
5313 integer :: status
5314!
5315 character (len=*), parameter :: MyFile = &
5316 & __FILE__//", pio_netcdf_get_ivar_1d"
5317!
5318 TYPE (File_desc_t) :: my_pioFile
5319 TYPE (Var_desc_t) :: my_pioVar
5320!
5321!-----------------------------------------------------------------------
5322! Read in an integer 1D-array variable.
5323!-----------------------------------------------------------------------
5324!
5325! If file descriptor is not provided, open NetCDF for reading.
5326!
5327 IF (.not.PRESENT(piofile)) THEN
5328 CALL pio_netcdf_open (ng, model, trim(ncname), 0, my_piofile)
5329 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5330 ELSE
5331 my_piofile=piofile
5332 END IF
5333!
5334! Read in variable.
5335!
5336 status=pio_inq_varid(my_piofile, trim(myvarname), my_piovar)
5337 IF (status.eq.pio_noerr) THEN
5338 IF (PRESENT(start).and.PRESENT(total)) THEN
5339 status=pio_get_var(my_piofile, my_piovar, start, total, a)
5340 ELSE
5341 status=pio_get_var(my_piofile, my_piovar, a)
5342 END IF
5343 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
5344 IF (master) WRITE (stdout,10) trim(myvarname), trim(ncname), &
5345 & trim(sourcefile)
5346 exit_flag=2
5347 ioerror=status
5348 END IF
5349 ELSE
5350 IF (master) WRITE (stdout,20) trim(myvarname), trim(ncname), &
5351 & trim(sourcefile)
5352 exit_flag=2
5353 ioerror=status
5354 END IF
5355!
5356! If file descriptor is not provided, close input NetCDF file.
5357!
5358 IF (.not.PRESENT(piofile)) THEN
5359 CALL pio_netcdf_close (ng, model, my_piofile, ncname, .false.)
5360 END IF
5361!
5362 10 FORMAT (/,' PIO_NETCDF_GET_IVAR_1D - error while reading ', &
5363 & 'variable:',2x,a,/,26x,'in input file:',2x,a, &
5364 & /,26x,'call from:',2x,a)
5365 20 FORMAT (/,' PIO_NETCDF_GET_IVAR_1D - error while inquiring ', &
5366 & 'descriptor for variable:',2x,a, &
5367 & /,26x,'in input file:',2x,a,/,25x,'call from:',2x,a)
5368!
5369 RETURN

References mod_scalars::exit_flag, strings_mod::founderror(), mod_iounits::ioerror, mod_parallel::master, mod_scalars::noerror, mod_pio_netcdf::pio_netcdf_close(), mod_pio_netcdf::pio_netcdf_open(), mod_iounits::sourcefile, and mod_iounits::stdout.

Here is the call graph for this function:

◆ pio_netcdf_get_ivar_2d()

subroutine mod_pio_netcdf::pio_netcdf_get_ivar::pio_netcdf_get_ivar_2d ( integer, intent(in) ng,
integer, intent(in) model,
character (len=*), intent(in) ncname,
character (len=*), intent(in) myvarname,
integer, dimension(:,:), intent(out) a,
type (file_desc_t), intent(in), optional piofile,
integer, dimension(:), intent(in), optional start,
integer, dimension(:), intent(in), optional total )

Definition at line 5372 of file mod_pio_netcdf.F.

5374!
5375!=======================================================================
5376! !
5377! This routine reads requested integer 2D-array variable from !
5378! specified NetCDF file. !
5379! !
5380! On Input: !
5381! !
5382! ng Nested grid number (integer) !
5383! model Calling model identifier (integer) !
5384! ncname NetCDF file name (string) !
5385! myVarName Variable name (string) !
5386! pioFile PIO file descriptor, TYPE(File_desc_t), OPTIONAL !
5387! pioFile%fh file handler !
5388! pioFile%iosystem IO system descriptor (struct) !
5389! start Starting index where the first of the data values !
5390! will be read along each dimension (integer, !
5391! OPTIONAL) !
5392! total Number of data values to be read along each !
5393! dimension (integer, OPTIONAL) !
5394! !
5395! On Ouput: !
5396! !
5397! A Read 2D-array variable (integer) !
5398! !
5399! Examples: !
5400! !
5401! CALL pio_netcdf_get_ivar (ng, iNLM, 'f.nc', 'VarName', A) !
5402! CALL pio_netcdf_get_ivar (ng, iNLM, 'f.nc', 'VarName', A(0:,:)) !
5403! CALL pio_netcdf_get_ivar (ng, iNLM, 'f.nc', 'VarName', A(0:,0:)) !
5404! CALL pio_netcdf_get_ivar (ng, iNLM, 'f.nc', 'VarName', A(:,:,1)) !
5405! !
5406!=======================================================================
5407!
5408! Imported variable declarations.
5409!
5410 integer, intent(in) :: ng, model
5411
5412 integer, intent(in), optional :: start(:)
5413 integer, intent(in), optional :: total(:)
5414!
5415 character (len=*), intent(in) :: ncname
5416 character (len=*), intent(in) :: myVarName
5417!
5418 integer, intent(out) :: A(:,:)
5419!
5420 TYPE (File_desc_t), intent(in), optional :: pioFile
5421!
5422! Local variable declarations.
5423!
5424 integer :: status
5425!
5426 character (len=*), parameter :: MyFile = &
5427 & __FILE__//", pio_netcdf_get_ivar_2d"
5428!
5429 TYPE (File_desc_t) :: my_pioFile
5430 TYPE (Var_desc_t) :: my_pioVar
5431!
5432!-----------------------------------------------------------------------
5433! Read in an integer 2D-array variable.
5434!-----------------------------------------------------------------------
5435!
5436! If file descriptor is not provided, open NetCDF for reading.
5437!
5438 IF (.not.PRESENT(piofile)) THEN
5439 CALL pio_netcdf_open (ng, model, trim(ncname), 0, my_piofile)
5440 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
5441 ELSE
5442 my_piofile=piofile
5443 END IF
5444!
5445! Read in variable.
5446!
5447 status=pio_inq_varid(my_piofile, trim(myvarname), my_piovar)
5448 IF (status.eq.pio_noerr) THEN
5449 IF (PRESENT(start).and.PRESENT(total)) THEN
5450 status=pio_get_var(my_piofile, my_piovar, start, total, a)
5451 ELSE
5452 status=pio_get_var(my_piofile, my_piovar, a)
5453 END IF
5454 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
5455 IF (master) WRITE (stdout,10) trim(myvarname), trim(ncname), &
5456 & trim(sourcefile)
5457 exit_flag=2
5458 ioerror=status
5459 END IF
5460 ELSE
5461 IF (master) WRITE (stdout,20) trim(myvarname), trim(ncname), &
5462 & trim(sourcefile)
5463 exit_flag=2
5464 ioerror=status
5465 END IF
5466!
5467! If file descriptor is not provided, close input NetCDF file.
5468!
5469 IF (.not.PRESENT(piofile)) THEN
5470 CALL pio_netcdf_close (ng, model, my_piofile, ncname, .false.)
5471 END IF
5472!
5473 10 FORMAT (/,' PIO_NETCDF_GET_IVAR_2D - error while reading ', &
5474 & 'variable:',2x,a,/,26x,'in input file:',2x,a, &
5475 & /,26x,'call from:',2x,a)
5476 20 FORMAT (/,' PIO_NETCDF_GET_IVAR_2D - error while inquiring ', &
5477 & 'descriptor for variable:',2x,a, &
5478 & /,26x,'in input file:',2x,a,/,25x,'call from:',2x,a)
5479!
5480 RETURN

References mod_scalars::exit_flag, strings_mod::founderror(), mod_iounits::ioerror, mod_parallel::master, mod_scalars::noerror, mod_pio_netcdf::pio_netcdf_close(), mod_pio_netcdf::pio_netcdf_open(), mod_iounits::sourcefile, and mod_iounits::stdout.

Here is the call graph for this function:

The documentation for this interface was generated from the following file: