open netcdf file
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(t_ncfile), | intent(inout) | :: | sf |
self |
SUBROUTINE ncfile_openfile( sf) ! MODULES IMPLICIT NONE !------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES !------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES CLASS(t_ncfile),INTENT(INOUT) :: sf !! self !------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES !=============================================================================================================================== CALL mpi_check_single_access() IF(sf%isopen) RETURN #if NETCDF SELECT CASE(sf%rwo_mode) CASE("r") sf%ioError = nf90_OPEN(TRIM(sf%fileName), nf90_NOWRITE, sf%nc_id) CALL sf%handle_error("opening file '"//TRIM(sf%filename)//"' in read mode",& TypeInfo="FileNotFoundError") CASE("w") sf%ioError = nf90_OPEN(TRIM(sf%fileName), nf90_WRITE, sf%nc_id) CALL sf%handle_error("opening file '"//TRIM(sf%filename)//"' in write mode",& TypeInfo="FileNotFoundError") CASE("o") sf%ioError = nf90_CREATE(TRIM(sf%fileName), NF90_64BIT_OFFSET, sf%nc_id) CALL sf%handle_error("creating or overwriting file '"//TRIM(sf%filename)) END SELECT sf%isopen=.TRUE. #else CALL abort(__STAMP__,& "cannot open netcdf file, since code is compiled with BUILD_NETCDF=OFF") #endif /*NETCDF*/ END SUBROUTINE ncfile_openfile