@@ -436,7 +436,7 @@ recursive subroutine ncdf_crt(this,dic)
436436    type (var) ::  v
437437    character (len= DICT_KEY_LENGTH) ::  key
438438    character (len= NF90_MAX_NAME) ::  name, char
439-     character (len= 50 ), allocatable  ::  dims(:)
439+     character (len= 64 ), allocatable  ::  dims(:)
440440    integer , pointer  ::  chunks(:) = > null ()
441441    integer  ::  d_n, type, i, n_d, j
442442    !  Type declarations
@@ -2016,34 +2016,36 @@ subroutine ncdf_print(this)
20162016      else  if  ( this% define == 1  ) then 
20172017        write (* ," (a20,a)"  ) " In define-mode:     "  ," False" 
20182018      end if 
2019-       call  ncdf_inq(this, dims= ndims, vars= nvars, atts= ngatts, &
2020-           grps= ngrps, format = file_format)
2021-       select case  ( file_format ) 
2022-       case  ( NF90_FORMAT_CLASSIC )
2023-         write (* ," (a20,a)"  ) " File format:        "  ," Classic" 
2024-       case  ( NF90_FORMAT_64BIT )
2025-         write (* ," (a20,a)"  ) " File format:        "  ," Classic 64Bit" 
2026-       case  ( NF90_FORMAT_NETCDF4 )
2027-         write (* ," (a20,a)"  ) " File format:        "  ," NetCDF4" 
2028-         write (* ," (a20,i7)"  )" Default compression:"  ,this% comp_lvl
2029-       case  ( NF90_FORMAT_NETCDF4_CLASSIC )
2030-         write (* ," (a20,a)"  ) " File format:        "  ," NetCDF4 Classic format" 
2031-         write (* ," (a22,i7)"  )" Default compression:  "  ,this% comp_lvl
2032-       case default 
2033-         write (* ," (a20,a)"  ) " File format:        "  ," Could not be determined" 
2034-       end select 
2035-       write (* ," (a20,i7)"  ) " Number of dimensions:  "  ,ndims
2036-       write (* ," (a20,i7)"  ) " Number of variables:   "  ,nvars
2037-       write (* ," (a20,i7)"  ) " Number of attributes:  "  ,ngatts
2038-       if  ( ngrps >=  0  ) then 
2039-         write (* ," (a20,i7)"  ) " Number of groups:      "  ,ngrps
2019+       if  ( this% f_id >=  0  ) then 
2020+         call  ncdf_inq(this, dims= ndims, vars= nvars, atts= ngatts, &
2021+             grps= ngrps, format = file_format)
2022+         select case  ( file_format ) 
2023+         case  ( NF90_FORMAT_CLASSIC )
2024+           write (* ," (a20,a)"  ) " File format:        "  ," Classic" 
2025+         case  ( NF90_FORMAT_64BIT )
2026+           write (* ," (a20,a)"  ) " File format:        "  ," Classic 64Bit" 
2027+         case  ( NF90_FORMAT_NETCDF4 )
2028+           write (* ," (a20,a)"  ) " File format:        "  ," NetCDF4" 
2029+           write (* ," (a20,i7)"  )" Default compression:"  ,this% comp_lvl
2030+         case  ( NF90_FORMAT_NETCDF4_CLASSIC )
2031+           write (* ," (a20,a)"  ) " File format:        "  ," NetCDF4 Classic format" 
2032+           write (* ," (a22,i7)"  )" Default compression:  "  ,this% comp_lvl
2033+         case default 
2034+           write (* ," (a20,a)"  ) " File format:        "  ," Could not be determined" 
2035+         end select 
2036+         write (* ," (a20,i7)"  ) " Number of dimensions:  "  ,ndims
2037+         write (* ," (a20,i7)"  ) " Number of variables:   "  ,nvars
2038+         write (* ," (a20,i7)"  ) " Number of attributes:  "  ,ngatts
2039+         if  ( ngrps >=  0  ) then 
2040+           write (* ," (a20,i7)"  ) " Number of groups:      "  ,ngrps
2041+         end if 
20402042      end if 
2041-       if  ( iand (NF90_WRITE,this% mode) == NF90_WRITE ) &
2042-           write (* ," (a20,a)"  ) " NetCDF mode:        "  ," NF90_WRITE" 
2043-       if  ( iand (NF90_NOCLOBBER,this% mode) == NF90_NOCLOBBER ) then 
2044-         write (* ," (a20,a)"  ) " NetCDF mode:        "  ," NF90_NOCLOBBER" 
2045-       else 
2046-         write (* ," (a20,a)"  ) " NetCDF mode:        "  ," NF90_CLOBBER" 
2043+          if  ( iand (NF90_WRITE,this% mode) == NF90_WRITE ) &
2044+              write (* ," (a20,a)"  ) " NetCDF mode:        "  ," NF90_WRITE" 
2045+          if  ( iand (NF90_NOCLOBBER,this% mode) == NF90_NOCLOBBER ) then 
2046+            write (* ," (a20,a)"  ) " NetCDF mode:        "  ," NF90_NOCLOBBER" 
2047+          else 
2048+            write (* ," (a20,a)"  ) " NetCDF mode:        "  ," NF90_CLOBBER" 
20472049      end if 
20482050      if  ( iand (NF90_NOFILL,this% mode) == NF90_NOFILL ) &
20492051          write (* ," (a20,a)"  ) " NetCDF mode:        "  ," NF90_NOFILL" 
0 commit comments