allocate and initialize class and open/close the netcdf file and define read ("r") or write ("w" includes read) mode
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(t_ncfile), | intent(inout), | ALLOCATABLE | :: | sf |
self |
|
| character(len=*), | intent(in) | :: | Filename | |||
| character(len=1), | intent(in) | :: | rwo_mode |
SUBROUTINE ncfile_init(sf,FileName,rwo_mode) ! MODULES IMPLICIT NONE !------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES CHARACTER(LEN=*),INTENT(IN) :: Filename CHARACTER(LEN=1),INTENT(IN) :: rwo_mode !either read "r" or write "w" (existing file) or "o" createnew or overwrite !------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES CLASS(t_ncfile), ALLOCATABLE,INTENT(INOUT) :: sf !! self !------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES !=============================================================================================================================== CALL mpi_check_single_access() ALLOCATE(t_ncfile :: sf) sf%isopen=.FALSE. sf%nc_id=0 sf%filename=TRIM(FileName) sf%rwo_mode=rwo_mode CALL sf%openfile() END SUBROUTINE ncfile_init