From 3acb049002dd1252de80f63c7978bd8d983ba1e5 Mon Sep 17 00:00:00 2001 From: Roy-KC Date: Mon, 21 Aug 2023 16:18:48 -0500 Subject: [PATCH] Move large automatic arrays to the heap netcdf_eightbyte.F90 and netcdf_expanded.F90 were generated with M4. Two changes repeated in numerous functions. defaultIntArray is allocated rather than placed on the stack. Added shapeValues variable to eliminate temporary stack usage by "reshape" intrinsic. --- fortran/netcdf4_eightbyte.F90 | 141 +++++---- fortran/netcdf_eightbyte.F90 | 196 +++++++----- fortran/netcdf_expanded.F90 | 576 ++++++++++++++++++---------------- 3 files changed, 502 insertions(+), 411 deletions(-) diff --git a/fortran/netcdf4_eightbyte.F90 b/fortran/netcdf4_eightbyte.F90 index a6c0d17f..0da6e91a 100644 --- a/fortran/netcdf4_eightbyte.F90 +++ b/fortran/netcdf4_eightbyte.F90 @@ -3,10 +3,10 @@ function nf90_put_var_1D_EightByteInt(ncid, varid, values, start, count, stride, integer (kind = EightByteInt), dimension(:), intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_1D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter, format_num - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -14,7 +14,7 @@ function nf90_put_var_1D_EightByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -376,14 +376,15 @@ function nf90_get_var_1D_EightByteInt(ncid, varid, values, start, count, stride, integer :: nf90_get_var_1D_EightByteInt integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter, format_num - integer, dimension(size(values)) :: defaultIntArray - integer (kind = EightByteInt), dimension(size(values)) :: defaultInt8Array + integer :: numDims, counter, format_num, shapeValues(1) + integer, dimension(:), allocatable :: defaultIntArray + integer (kind = EightByteInt), dimension(:), allocatable :: defaultInt8Array ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) @@ -395,6 +396,7 @@ function nf90_get_var_1D_EightByteInt(ncid, varid, values, start, count, stride, if (nf90_get_var_1D_EightByteInt .eq. nf90_noerr) then if (format_num .eq. nf90_format_netcdf4 .OR. & format_num .eq. nf90_format_cdf5) then + allocate(defaultInt8Array(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_1D_EightByteInt = & @@ -406,8 +408,10 @@ function nf90_get_var_1D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_1D_EightByteInt = & nf_get_vara_int64(ncid, varid, localStart, localCount, defaultInt8Array) end if - values(:) = reshape(defaultInt8Array(:), shape(values)) + values(:) = reshape(defaultInt8Array(:), shapeValues) + if (allocated(defaultInt8Array)) deallocate(defaultInt8Array) else + allocate(defaultIntArray(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_1D_EightByteInt = & @@ -419,7 +423,8 @@ function nf90_get_var_1D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_1D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:) = reshape(defaultIntArray(:), shape(values)) + values(:) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) endif endif end function nf90_get_var_1D_EightByteInt @@ -433,14 +438,15 @@ function nf90_get_var_2D_EightByteInt(ncid, varid, values, start, count, stride, integer :: nf90_get_var_2D_EightByteInt integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter, format_num - integer, dimension(size(values)) :: defaultIntArray - integer (kind = EightByteInt), dimension(size(values)) :: defaultInt8Array + integer :: numDims, counter, format_num, shapeValues(2) + integer, dimension(:), allocatable :: defaultIntArray + integer (kind = EightByteInt), dimension(:), allocatable :: defaultInt8Array ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) @@ -452,6 +458,7 @@ function nf90_get_var_2D_EightByteInt(ncid, varid, values, start, count, stride, if (nf90_get_var_2D_EightByteInt .eq. nf90_noerr) then if (format_num .eq. nf90_format_netcdf4 .OR. & format_num .eq. nf90_format_cdf5) then + allocate(defaultInt8Array(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_2D_EightByteInt = & @@ -463,8 +470,10 @@ function nf90_get_var_2D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_2D_EightByteInt = & nf_get_vara_int64(ncid, varid, localStart, localCount, defaultInt8Array) end if - values(:, :) = reshape(defaultInt8Array(:), shape(values)) + values(:, :) = reshape(defaultInt8Array(:), shapeValues) + if (allocated(defaultInt8Array)) deallocate(defaultInt8Array) else + allocate(defaultIntArray(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_2D_EightByteInt = & @@ -476,7 +485,8 @@ function nf90_get_var_2D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_2D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end if end if end function nf90_get_var_2D_EightByteInt @@ -490,14 +500,15 @@ function nf90_get_var_3D_EightByteInt(ncid, varid, values, start, count, stride, integer :: nf90_get_var_3D_EightByteInt integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter, format_num - integer, dimension(size(values)) :: defaultIntArray - integer (kind = EightByteInt), dimension(size(values)) :: defaultInt8Array + integer :: numDims, counter, format_num, shapeValues(3) + integer, dimension(:), allocatable :: defaultIntArray + integer (kind = EightByteInt), dimension(:), allocatable :: defaultInt8Array ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) @@ -509,6 +520,7 @@ function nf90_get_var_3D_EightByteInt(ncid, varid, values, start, count, stride, if (nf90_get_var_3D_EightByteInt .eq. nf90_noerr) then if (format_num .eq. nf90_format_netcdf4 .OR. & format_num .eq. nf90_format_cdf5) then + allocate(defaultInt8Array(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_3D_EightByteInt = & @@ -520,8 +532,10 @@ function nf90_get_var_3D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_3D_EightByteInt = & nf_get_vara_int64(ncid, varid, localStart, localCount, defaultInt8Array) end if - values(:, :, :) = reshape(defaultInt8Array(:), shape(values)) + values(:, :, :) = reshape(defaultInt8Array(:), shapeValues) + if (allocated(defaultInt8Array)) deallocate(defaultInt8Array) else + allocate(defaultIntArray(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_3D_EightByteInt = & @@ -533,7 +547,8 @@ function nf90_get_var_3D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_3D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end if end if end function nf90_get_var_3D_EightByteInt @@ -547,14 +562,15 @@ function nf90_get_var_4D_EightByteInt(ncid, varid, values, start, count, stride, integer :: nf90_get_var_4D_EightByteInt integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter, format_num - integer, dimension(size(values)) :: defaultIntArray - integer (kind = EightByteInt), dimension(size(values)) :: defaultInt8Array + integer :: numDims, counter, format_num, shapeValues(4) + integer, dimension(:), allocatable :: defaultIntArray + integer (kind = EightByteInt), dimension(:), allocatable :: defaultInt8Array ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) @@ -566,6 +582,7 @@ function nf90_get_var_4D_EightByteInt(ncid, varid, values, start, count, stride, if (nf90_get_var_4D_EightByteInt .eq. nf90_noerr) then if (format_num .eq. nf90_format_netcdf4 .OR. & format_num .eq. nf90_format_cdf5) then + allocate(defaultInt8Array(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_4D_EightByteInt = & @@ -577,8 +594,10 @@ function nf90_get_var_4D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_4D_EightByteInt = & nf_get_vara_int64(ncid, varid, localStart, localCount, defaultInt8Array) end if - values(:, :, :, :) = reshape(defaultInt8Array(:), shape(values)) + values(:, :, :, :) = reshape(defaultInt8Array(:), shapeValues) + if (allocated(defaultInt8Array)) deallocate(defaultInt8Array) else + allocate(defaultIntArray(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_4D_EightByteInt = & @@ -590,7 +609,8 @@ function nf90_get_var_4D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_4D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end if end if end function nf90_get_var_4D_EightByteInt @@ -604,14 +624,15 @@ function nf90_get_var_5D_EightByteInt(ncid, varid, values, start, count, stride, integer :: nf90_get_var_5D_EightByteInt integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter, format_num - integer, dimension(size(values)) :: defaultIntArray - integer (kind = EightByteInt), dimension(size(values)) :: defaultInt8Array + integer :: numDims, counter, format_num, shapeValues(5) + integer, dimension(:), allocatable :: defaultIntArray + integer (kind = EightByteInt), dimension(:), allocatable :: defaultInt8Array ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) @@ -623,6 +644,7 @@ function nf90_get_var_5D_EightByteInt(ncid, varid, values, start, count, stride, if (nf90_get_var_5D_EightByteInt .eq. nf90_noerr) then if (format_num .eq. nf90_format_netcdf4 .OR. & format_num .eq. nf90_format_cdf5) then + allocate(defaultInt8Array(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_5D_EightByteInt = & @@ -634,8 +656,10 @@ function nf90_get_var_5D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_5D_EightByteInt = & nf_get_vara_int64(ncid, varid, localStart, localCount, defaultInt8Array) end if - values(:, :, :, :, :) = reshape(defaultInt8Array(:), shape(values)) + values(:, :, :, :, :) = reshape(defaultInt8Array(:), shapeValues) + if (allocated(defaultInt8Array)) deallocate(defaultInt8Array) else + allocate(defaultIntArray(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_5D_EightByteInt = & @@ -647,7 +671,8 @@ function nf90_get_var_5D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_5D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end if end if end function nf90_get_var_5D_EightByteInt @@ -661,14 +686,15 @@ function nf90_get_var_6D_EightByteInt(ncid, varid, values, start, count, stride, integer :: nf90_get_var_6D_EightByteInt integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter, format_num - integer, dimension(size(values)) :: defaultIntArray - integer (kind = EightByteInt), dimension(size(values)) :: defaultInt8Array + integer :: numDims, counter, format_num, shapeValues(6) + integer, dimension(:), allocatable :: defaultIntArray + integer (kind = EightByteInt), dimension(:), allocatable :: defaultInt8Array ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) @@ -680,6 +706,7 @@ function nf90_get_var_6D_EightByteInt(ncid, varid, values, start, count, stride, if (nf90_get_var_6D_EightByteInt .eq. nf90_noerr) then if (format_num .eq. nf90_format_netcdf4 .OR. & format_num .eq. nf90_format_cdf5) then + allocate(defaultInt8Array(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_6D_EightByteInt = & @@ -691,8 +718,10 @@ function nf90_get_var_6D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_6D_EightByteInt = & nf_get_vara_int64(ncid, varid, localStart, localCount, defaultInt8Array) end if - values(:, :, :, :, :, :) = reshape(defaultInt8Array(:), shape(values)) + values(:, :, :, :, :, :) = reshape(defaultInt8Array(:), shapeValues) + if (allocated(defaultInt8Array)) deallocate(defaultInt8Array) else + allocate(defaultIntArray(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_6D_EightByteInt = & @@ -704,7 +733,8 @@ function nf90_get_var_6D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_6D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :, :, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :, :, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end if end if end function nf90_get_var_6D_EightByteInt @@ -718,14 +748,15 @@ function nf90_get_var_7D_EightByteInt(ncid, varid, values, start, count, stride, integer :: nf90_get_var_7D_EightByteInt integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter, format_num - integer, dimension(size(values)) :: defaultIntArray - integer (kind = EightByteInt), dimension(size(values)) :: defaultInt8Array + integer :: numDims, counter, format_num, shapeValues(7) + integer, dimension(:), allocatable :: defaultIntArray + integer (kind = EightByteInt), dimension(:), allocatable :: defaultInt8Array ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) @@ -737,6 +768,7 @@ function nf90_get_var_7D_EightByteInt(ncid, varid, values, start, count, stride, if (nf90_get_var_7D_EightByteInt .eq. nf90_noerr) then if (format_num .eq. nf90_format_netcdf4 .OR. & format_num .eq. nf90_format_cdf5) then + allocate(defaultInt8Array(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_7D_EightByteInt = & @@ -748,8 +780,10 @@ function nf90_get_var_7D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_7D_EightByteInt = & nf_get_vara_int64(ncid, varid, localStart, localCount, defaultInt8Array) end if - values(:, :, :, :, :, :, :) = reshape(defaultInt8Array(:), shape(values)) + values(:, :, :, :, :, :, :) = reshape(defaultInt8Array(:), shapeValues) + if (allocated(defaultInt8Array)) deallocate(defaultInt8Array) else + allocate(defaultIntArray(size(values))) if(present(map)) then localMap (:size(map)) = map(:) nf90_get_var_7D_EightByteInt = & @@ -761,10 +795,11 @@ function nf90_get_var_7D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_7D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :, :, :, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :, :, :, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end if end if - + end function nf90_get_var_7D_EightByteInt diff --git a/fortran/netcdf_eightbyte.F90 b/fortran/netcdf_eightbyte.F90 index 0ab290c0..a80a1967 100644 --- a/fortran/netcdf_eightbyte.F90 +++ b/fortran/netcdf_eightbyte.F90 @@ -1,13 +1,13 @@ - function nf90_put_var_1D_EightByteInt(ncid, varid, values, start, count, stride, map) + function nf90_put_var_1D_EightByteInt(ncid, varid, values, start, count, stride, map) integer, intent( in) :: ncid, varid integer (kind = EightByteInt), dimension(:), & intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_1D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -15,7 +15,7 @@ function nf90_put_var_1D_EightByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -39,10 +39,10 @@ function nf90_put_var_2D_EightByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_2D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -50,7 +50,7 @@ function nf90_put_var_2D_EightByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -74,10 +74,10 @@ function nf90_put_var_3D_EightByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_3D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -85,7 +85,7 @@ function nf90_put_var_3D_EightByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -109,10 +109,10 @@ function nf90_put_var_4D_EightByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_4D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -120,7 +120,7 @@ function nf90_put_var_4D_EightByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -144,10 +144,10 @@ function nf90_put_var_5D_EightByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_5D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -155,7 +155,7 @@ function nf90_put_var_5D_EightByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -179,10 +179,10 @@ function nf90_put_var_6D_EightByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_6D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -190,7 +190,7 @@ function nf90_put_var_6D_EightByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -214,10 +214,10 @@ function nf90_put_var_7D_EightByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_7D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -225,7 +225,7 @@ function nf90_put_var_7D_EightByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -249,19 +249,22 @@ function nf90_get_var_1D_EightByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_1D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(1) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -276,7 +279,8 @@ function nf90_get_var_1D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_1D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:) = reshape(defaultIntArray(:), shape(values)) + values(:) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_1D_EightByteInt @@ -286,19 +290,22 @@ function nf90_get_var_2D_EightByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_2D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(2) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -313,7 +320,8 @@ function nf90_get_var_2D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_2D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_2D_EightByteInt @@ -323,19 +331,22 @@ function nf90_get_var_3D_EightByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_3D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(3) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -350,7 +361,8 @@ function nf90_get_var_3D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_3D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_3D_EightByteInt @@ -360,19 +372,22 @@ function nf90_get_var_4D_EightByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_4D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(4) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -387,7 +402,8 @@ function nf90_get_var_4D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_4D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_4D_EightByteInt @@ -397,19 +413,22 @@ function nf90_get_var_5D_EightByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_5D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(5) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -424,7 +443,8 @@ function nf90_get_var_5D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_5D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_5D_EightByteInt @@ -434,19 +454,22 @@ function nf90_get_var_6D_EightByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_6D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(6) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -461,7 +484,8 @@ function nf90_get_var_6D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_6D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :, :, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :, :, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_6D_EightByteInt @@ -471,19 +495,22 @@ function nf90_get_var_7D_EightByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_7D_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(7) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -498,7 +525,8 @@ function nf90_get_var_7D_EightByteInt(ncid, varid, values, start, count, stride, nf90_get_var_7D_EightByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :, :, :, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :, :, :, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_7D_EightByteInt @@ -507,13 +535,13 @@ function nf90_put_var_EightByteInt(ncid, varid, values, start) integer (kind = EightByteInt), intent( in) :: values integer, dimension(:), optional, intent( in) :: start integer :: nf90_put_var_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localIndex - + ! Set local arguments to default values localIndex(:) = 1 if(present(start)) localIndex(:size(start)) = start(:) - + nf90_put_var_EightByteInt = nf_put_var1_int(ncid, varid, localIndex, int(values)) end function nf90_put_var_EightByteInt @@ -523,14 +551,14 @@ function nf90_get_var_EightByteInt(ncid, varid, values, start) integer (kind = EightByteInt), intent(out) :: values integer, dimension(:), optional, intent( in) :: start integer :: nf90_get_var_EightByteInt - + integer, dimension(nf90_max_var_dims) :: localIndex integer :: defaultInteger - + ! Set local arguments to default values localIndex(:) = 1 if(present(start)) localIndex(:size(start)) = start(:) - + nf90_get_var_EightByteInt = nf_get_var1_int(ncid, varid, localIndex, defaultInteger) values = defaultInteger end function nf90_get_var_EightByteInt diff --git a/fortran/netcdf_expanded.F90 b/fortran/netcdf_expanded.F90 index 5d16418f..9caf6e45 100644 --- a/fortran/netcdf_expanded.F90 +++ b/fortran/netcdf_expanded.F90 @@ -4,13 +4,13 @@ function nf90_put_var_OneByteInt(ncid, varid, values, start) integer (kind = OneByteInt), intent( in) :: values integer, dimension(:), optional, intent( in) :: start integer :: nf90_put_var_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localIndex ! Set local arguments to default values localIndex(:) = 1 if(present(start)) localIndex(:size(start)) = start(:) - + nf90_put_var_OneByteInt = nf_put_var1_int1(ncid, varid, localIndex, values) end function nf90_put_var_OneByteInt @@ -20,13 +20,13 @@ function nf90_put_var_TwoByteInt(ncid, varid, values, start) integer (kind = TwoByteInt), intent( in) :: values integer, dimension(:), optional, intent( in) :: start integer :: nf90_put_var_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localIndex ! Set local arguments to default values localIndex(:) = 1 if(present(start)) localIndex(:size(start)) = start(:) - + nf90_put_var_TwoByteInt = nf_put_var1_int2(ncid, varid, localIndex, values) end function nf90_put_var_TwoByteInt @@ -36,13 +36,13 @@ function nf90_put_var_FourByteInt(ncid, varid, values, start) integer (kind = FourByteInt), intent( in) :: values integer, dimension(:), optional, intent( in) :: start integer :: nf90_put_var_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localIndex ! Set local arguments to default values localIndex(:) = 1 if(present(start)) localIndex(:size(start)) = start(:) - + nf90_put_var_FourByteInt = nf_put_var1_int(ncid, varid, localIndex, int(values)) end function nf90_put_var_FourByteInt @@ -52,13 +52,13 @@ function nf90_put_var_FourByteReal(ncid, varid, values, start) real (kind = FourByteReal), intent( in) :: values integer, dimension(:), optional, intent( in) :: start integer :: nf90_put_var_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localIndex ! Set local arguments to default values localIndex(:) = 1 if(present(start)) localIndex(:size(start)) = start(:) - + nf90_put_var_FourByteReal = nf_put_var1_real(ncid, varid, localIndex, values) end function nf90_put_var_FourByteReal @@ -68,13 +68,13 @@ function nf90_put_var_EightByteReal(ncid, varid, values, start) real (kind = EightByteReal), intent( in) :: values integer, dimension(:), optional, intent( in) :: start integer :: nf90_put_var_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localIndex ! Set local arguments to default values localIndex(:) = 1 if(present(start)) localIndex(:size(start)) = start(:) - + nf90_put_var_EightByteReal = nf_put_var1_double(ncid, varid, localIndex, values) end function nf90_put_var_EightByteReal @@ -84,13 +84,13 @@ function nf90_get_var_OneByteInt(ncid, varid, values, start) integer (kind = OneByteInt), intent(out) :: values integer, dimension(:), optional, intent( in) :: start integer :: nf90_get_var_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localIndex ! Set local arguments to default values localIndex(:) = 1 if(present(start)) localIndex(:size(start)) = start(:) - + nf90_get_var_OneByteInt = nf_get_var1_int1(ncid, varid, localIndex, values) end function nf90_get_var_OneByteInt @@ -100,13 +100,13 @@ function nf90_get_var_TwoByteInt(ncid, varid, values, start) integer (kind = TwoByteInt), intent(out) :: values integer, dimension(:), optional, intent( in) :: start integer :: nf90_get_var_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localIndex ! Set local arguments to default values localIndex(:) = 1 if(present(start)) localIndex(:size(start)) = start(:) - + nf90_get_var_TwoByteInt = nf_get_var1_int2(ncid, varid, localIndex, values) end function nf90_get_var_TwoByteInt @@ -116,14 +116,14 @@ function nf90_get_var_FourByteInt(ncid, varid, values, start) integer (kind = FourByteInt), intent(out) :: values integer, dimension(:), optional, intent( in) :: start integer :: nf90_get_var_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localIndex integer :: defaultInteger - + ! Set local arguments to default values localIndex(:) = 1 if(present(start)) localIndex(:size(start)) = start(:) - + nf90_get_var_FourByteInt = nf_get_var1_int(ncid, varid, localIndex, defaultInteger) values = defaultInteger end function nf90_get_var_FourByteInt @@ -134,13 +134,13 @@ function nf90_get_var_FourByteReal(ncid, varid, values, start) real (kind = FourByteReal), intent(out) :: values integer, dimension(:), optional, intent( in) :: start integer :: nf90_get_var_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localIndex ! Set local arguments to default values localIndex(:) = 1 if(present(start)) localIndex(:size(start)) = start(:) - + nf90_get_var_FourByteReal = nf_get_var1_real(ncid, varid, localIndex, values) end function nf90_get_var_FourByteReal @@ -150,13 +150,13 @@ function nf90_get_var_EightByteReal(ncid, varid, values, start) real (kind = EightByteReal), intent(out) :: values integer, dimension(:), optional, intent( in) :: start integer :: nf90_get_var_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localIndex ! Set local arguments to default values localIndex(:) = 1 if(present(start)) localIndex(:size(start)) = start(:) - + nf90_get_var_EightByteReal = nf_get_var1_double(ncid, varid, localIndex, values) end function nf90_get_var_EightByteReal @@ -168,10 +168,10 @@ function nf90_put_var_1D_OneByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_1D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -179,7 +179,7 @@ function nf90_put_var_1D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -203,10 +203,10 @@ function nf90_put_var_2D_OneByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_2D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -214,7 +214,7 @@ function nf90_put_var_2D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -238,10 +238,10 @@ function nf90_put_var_3D_OneByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_3D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -249,7 +249,7 @@ function nf90_put_var_3D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -273,10 +273,10 @@ function nf90_put_var_4D_OneByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_4D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -284,7 +284,7 @@ function nf90_put_var_4D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -308,10 +308,10 @@ function nf90_put_var_5D_OneByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_5D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -319,7 +319,7 @@ function nf90_put_var_5D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -343,10 +343,10 @@ function nf90_put_var_6D_OneByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_6D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -354,7 +354,7 @@ function nf90_put_var_6D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -378,10 +378,10 @@ function nf90_put_var_7D_OneByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_7D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -389,7 +389,7 @@ function nf90_put_var_7D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -413,10 +413,10 @@ function nf90_put_var_1D_TwoByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_1D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -424,7 +424,7 @@ function nf90_put_var_1D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -448,10 +448,10 @@ function nf90_put_var_2D_TwoByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_2D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -459,7 +459,7 @@ function nf90_put_var_2D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -483,10 +483,10 @@ function nf90_put_var_3D_TwoByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_3D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -494,7 +494,7 @@ function nf90_put_var_3D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -518,10 +518,10 @@ function nf90_put_var_4D_TwoByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_4D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -529,7 +529,7 @@ function nf90_put_var_4D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -553,10 +553,10 @@ function nf90_put_var_5D_TwoByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_5D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -564,7 +564,7 @@ function nf90_put_var_5D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -588,10 +588,10 @@ function nf90_put_var_6D_TwoByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_6D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -599,7 +599,7 @@ function nf90_put_var_6D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -623,10 +623,10 @@ function nf90_put_var_7D_TwoByteInt(ncid, varid, values, start, count, stride, m intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_7D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -634,7 +634,7 @@ function nf90_put_var_7D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -658,10 +658,10 @@ function nf90_put_var_1D_FourByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_1D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -669,7 +669,7 @@ function nf90_put_var_1D_FourByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -693,10 +693,10 @@ function nf90_put_var_2D_FourByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_2D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -704,20 +704,20 @@ function nf90_put_var_2D_FourByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) if(present(map)) then - localMap (:size(map)) = map(:) - nf90_put_var_2D_FourByteInt = & - nf_put_varm_int(ncid, varid, localStart, localCount, localStride, localMap, int(values)) + localMap (:size(map)) = map(:) + nf90_put_var_2D_FourByteInt = & + nf_put_varm_int(ncid, varid, localStart, localCount, localStride, localMap, int(values)) else if(present(stride)) then - nf90_put_var_2D_FourByteInt = & - nf_put_vars_int(ncid, varid, localStart, localCount, localStride, int(values)) + nf90_put_var_2D_FourByteInt = & + nf_put_vars_int(ncid, varid, localStart, localCount, localStride, int(values)) else - nf90_put_var_2D_FourByteInt = & - nf_put_vara_int(ncid, varid, localStart, localCount, values) + nf90_put_var_2D_FourByteInt = & + nf_put_vara_int(ncid, varid, localStart, localCount, values) end if end function nf90_put_var_2D_FourByteInt @@ -728,10 +728,10 @@ function nf90_put_var_3D_FourByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_3D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -739,7 +739,7 @@ function nf90_put_var_3D_FourByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -763,10 +763,10 @@ function nf90_put_var_4D_FourByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_4D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -774,7 +774,7 @@ function nf90_put_var_4D_FourByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -798,10 +798,10 @@ function nf90_put_var_5D_FourByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_5D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -809,7 +809,7 @@ function nf90_put_var_5D_FourByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -833,10 +833,10 @@ function nf90_put_var_6D_FourByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_6D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -844,7 +844,7 @@ function nf90_put_var_6D_FourByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -868,10 +868,10 @@ function nf90_put_var_7D_FourByteInt(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_7D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -879,7 +879,7 @@ function nf90_put_var_7D_FourByteInt(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -897,16 +897,16 @@ function nf90_put_var_7D_FourByteInt(ncid, varid, values, start, count, stride, end function nf90_put_var_7D_FourByteInt - function nf90_put_var_1D_FourByteReal(ncid, varid, values, start, count, stride, map) + function nf90_put_var_1D_FourByteReal(ncid, varid, values, start, count, stride, map) integer, intent( in) :: ncid, varid real (kind = FourByteReal), dimension(:), & intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_1D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -914,7 +914,7 @@ function nf90_put_var_1D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -938,10 +938,10 @@ function nf90_put_var_2D_FourByteReal(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_2D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -949,7 +949,7 @@ function nf90_put_var_2D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -973,10 +973,10 @@ function nf90_put_var_3D_FourByteReal(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_3D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -984,7 +984,7 @@ function nf90_put_var_3D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1008,10 +1008,10 @@ function nf90_put_var_4D_FourByteReal(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_4D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1019,7 +1019,7 @@ function nf90_put_var_4D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1043,10 +1043,10 @@ function nf90_put_var_5D_FourByteReal(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_5D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1054,7 +1054,7 @@ function nf90_put_var_5D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1078,10 +1078,10 @@ function nf90_put_var_6D_FourByteReal(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_6D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1089,7 +1089,7 @@ function nf90_put_var_6D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1113,10 +1113,10 @@ function nf90_put_var_7D_FourByteReal(ncid, varid, values, start, count, stride, intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_7D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1124,7 +1124,7 @@ function nf90_put_var_7D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1148,10 +1148,10 @@ function nf90_put_var_1D_EightByteReal(ncid, varid, values, start, count, stride intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_1D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1159,7 +1159,7 @@ function nf90_put_var_1D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1183,10 +1183,10 @@ function nf90_put_var_2D_EightByteReal(ncid, varid, values, start, count, stride intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_2D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1194,7 +1194,7 @@ function nf90_put_var_2D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1218,10 +1218,10 @@ function nf90_put_var_3D_EightByteReal(ncid, varid, values, start, count, stride intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_3D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1229,7 +1229,7 @@ function nf90_put_var_3D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1253,10 +1253,10 @@ function nf90_put_var_4D_EightByteReal(ncid, varid, values, start, count, stride intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_4D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1264,7 +1264,7 @@ function nf90_put_var_4D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1288,10 +1288,10 @@ function nf90_put_var_5D_EightByteReal(ncid, varid, values, start, count, stride intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_5D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1299,7 +1299,7 @@ function nf90_put_var_5D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1323,10 +1323,10 @@ function nf90_put_var_6D_EightByteReal(ncid, varid, values, start, count, stride intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_6D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1334,7 +1334,7 @@ function nf90_put_var_6D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1358,10 +1358,10 @@ function nf90_put_var_7D_EightByteReal(ncid, varid, values, start, count, stride intent( in) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_put_var_7D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1369,7 +1369,7 @@ function nf90_put_var_7D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1393,10 +1393,10 @@ function nf90_get_var_1D_OneByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_1D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1404,7 +1404,7 @@ function nf90_get_var_1D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1428,10 +1428,10 @@ function nf90_get_var_2D_OneByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_2D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1439,7 +1439,7 @@ function nf90_get_var_2D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1463,10 +1463,10 @@ function nf90_get_var_3D_OneByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_3D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1474,7 +1474,7 @@ function nf90_get_var_3D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1498,10 +1498,10 @@ function nf90_get_var_4D_OneByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_4D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1509,7 +1509,7 @@ function nf90_get_var_4D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1533,10 +1533,10 @@ function nf90_get_var_5D_OneByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_5D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1544,7 +1544,7 @@ function nf90_get_var_5D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1568,10 +1568,10 @@ function nf90_get_var_6D_OneByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_6D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1579,7 +1579,7 @@ function nf90_get_var_6D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1603,10 +1603,10 @@ function nf90_get_var_7D_OneByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_7D_OneByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1614,7 +1614,7 @@ function nf90_get_var_7D_OneByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1638,10 +1638,10 @@ function nf90_get_var_1D_TwoByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_1D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1649,7 +1649,7 @@ function nf90_get_var_1D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1673,10 +1673,10 @@ function nf90_get_var_2D_TwoByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_2D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1684,7 +1684,7 @@ function nf90_get_var_2D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1708,10 +1708,10 @@ function nf90_get_var_3D_TwoByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_3D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1719,7 +1719,7 @@ function nf90_get_var_3D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1743,10 +1743,10 @@ function nf90_get_var_4D_TwoByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_4D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1754,7 +1754,7 @@ function nf90_get_var_4D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1778,10 +1778,10 @@ function nf90_get_var_5D_TwoByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_5D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1789,7 +1789,7 @@ function nf90_get_var_5D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1813,10 +1813,10 @@ function nf90_get_var_6D_TwoByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_6D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1824,7 +1824,7 @@ function nf90_get_var_6D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1848,10 +1848,10 @@ function nf90_get_var_7D_TwoByteInt(ncid, varid, values, start, count, stride, m intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_7D_TwoByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -1859,7 +1859,7 @@ function nf90_get_var_7D_TwoByteInt(ncid, varid, values, start, count, stride, m localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1883,19 +1883,22 @@ function nf90_get_var_1D_FourByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_1D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(1) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1910,7 +1913,8 @@ function nf90_get_var_1D_FourByteInt(ncid, varid, values, start, count, stride, nf90_get_var_1D_FourByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:) = reshape(defaultIntArray(:), shape(values)) + values(:) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_1D_FourByteInt @@ -1920,19 +1924,22 @@ function nf90_get_var_2D_FourByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_2D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(2) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1947,7 +1954,8 @@ function nf90_get_var_2D_FourByteInt(ncid, varid, values, start, count, stride, nf90_get_var_2D_FourByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_2D_FourByteInt @@ -1957,19 +1965,22 @@ function nf90_get_var_3D_FourByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_3D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(3) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -1984,7 +1995,8 @@ function nf90_get_var_3D_FourByteInt(ncid, varid, values, start, count, stride, nf90_get_var_3D_FourByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_3D_FourByteInt @@ -1994,19 +2006,22 @@ function nf90_get_var_4D_FourByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_4D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(4) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2021,7 +2036,8 @@ function nf90_get_var_4D_FourByteInt(ncid, varid, values, start, count, stride, nf90_get_var_4D_FourByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_4D_FourByteInt @@ -2031,19 +2047,22 @@ function nf90_get_var_5D_FourByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_5D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(5) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2058,7 +2077,8 @@ function nf90_get_var_5D_FourByteInt(ncid, varid, values, start, count, stride, nf90_get_var_5D_FourByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_5D_FourByteInt @@ -2068,19 +2088,22 @@ function nf90_get_var_6D_FourByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_6D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(6) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2095,7 +2118,8 @@ function nf90_get_var_6D_FourByteInt(ncid, varid, values, start, count, stride, nf90_get_var_6D_FourByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :, :, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :, :, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_6D_FourByteInt @@ -2105,19 +2129,22 @@ function nf90_get_var_7D_FourByteInt(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_7D_FourByteInt - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap - integer :: numDims, counter - integer, dimension(size(values)) :: defaultIntArray - + integer :: numDims, counter, shapeValues(7) + integer, dimension(:), allocatable :: defaultIntArray + + allocate(defaultIntArray(size(values))) + ! Set local arguments to default values - numDims = size(shape(values)) + shapeValues = shape(values) + numDims = size(shapeValues) localStart (: ) = 1 - localCount (:numDims ) = shape(values) + localCount (:numDims ) = shapeValues localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2132,7 +2159,8 @@ function nf90_get_var_7D_FourByteInt(ncid, varid, values, start, count, stride, nf90_get_var_7D_FourByteInt = & nf_get_vara_int(ncid, varid, localStart, localCount, defaultIntArray) end if - values(:, :, :, :, :, :, :) = reshape(defaultIntArray(:), shape(values)) + values(:, :, :, :, :, :, :) = reshape(defaultIntArray(:), shapeValues) + if (allocated(defaultIntArray)) deallocate(defaultIntArray) end function nf90_get_var_7D_FourByteInt @@ -2142,10 +2170,10 @@ function nf90_get_var_1D_FourByteReal(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_1D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2153,7 +2181,7 @@ function nf90_get_var_1D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2177,10 +2205,10 @@ function nf90_get_var_2D_FourByteReal(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_2D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2188,7 +2216,7 @@ function nf90_get_var_2D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2212,10 +2240,10 @@ function nf90_get_var_3D_FourByteReal(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_3D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2223,7 +2251,7 @@ function nf90_get_var_3D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2247,10 +2275,10 @@ function nf90_get_var_4D_FourByteReal(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_4D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2258,7 +2286,7 @@ function nf90_get_var_4D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2282,10 +2310,10 @@ function nf90_get_var_5D_FourByteReal(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_5D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2293,7 +2321,7 @@ function nf90_get_var_5D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2317,10 +2345,10 @@ function nf90_get_var_6D_FourByteReal(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_6D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2328,7 +2356,7 @@ function nf90_get_var_6D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2352,10 +2380,10 @@ function nf90_get_var_7D_FourByteReal(ncid, varid, values, start, count, stride, intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_7D_FourByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2363,7 +2391,7 @@ function nf90_get_var_7D_FourByteReal(ncid, varid, values, start, count, stride, localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2387,10 +2415,10 @@ function nf90_get_var_1D_EightByteReal(ncid, varid, values, start, count, stride intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_1D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2398,7 +2426,7 @@ function nf90_get_var_1D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2422,10 +2450,10 @@ function nf90_get_var_2D_EightByteReal(ncid, varid, values, start, count, stride intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_2D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2433,7 +2461,7 @@ function nf90_get_var_2D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2457,10 +2485,10 @@ function nf90_get_var_3D_EightByteReal(ncid, varid, values, start, count, stride intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_3D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2468,7 +2496,7 @@ function nf90_get_var_3D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2492,10 +2520,10 @@ function nf90_get_var_4D_EightByteReal(ncid, varid, values, start, count, stride intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_4D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2503,7 +2531,7 @@ function nf90_get_var_4D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2527,10 +2555,10 @@ function nf90_get_var_5D_EightByteReal(ncid, varid, values, start, count, stride intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_5D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2538,7 +2566,7 @@ function nf90_get_var_5D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2562,10 +2590,10 @@ function nf90_get_var_6D_EightByteReal(ncid, varid, values, start, count, stride intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_6D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2573,7 +2601,7 @@ function nf90_get_var_6D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:) @@ -2597,10 +2625,10 @@ function nf90_get_var_7D_EightByteReal(ncid, varid, values, start, count, stride intent(out) :: values integer, dimension(:), optional, intent( in) :: start, count, stride, map integer :: nf90_get_var_7D_EightByteReal - + integer, dimension(nf90_max_var_dims) :: localStart, localCount, localStride, localMap integer :: numDims, counter - + ! Set local arguments to default values numDims = size(shape(values)) localStart (: ) = 1 @@ -2608,7 +2636,7 @@ function nf90_get_var_7D_EightByteReal(ncid, varid, values, start, count, stride localCount (numDims+1:) = 1 localStride(: ) = 1 localMap (:numDims ) = (/ 1, (product(localCount(:counter)), counter = 1, numDims - 1) /) - + if(present(start)) localStart (:size(start) ) = start(:) if(present(count)) localCount (:size(count) ) = count(:) if(present(stride)) localStride(:size(stride)) = stride(:)