This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
John, You can find out the actual dimension length in the netCDF file from your program by calling the appropriate netCDF functions to get the length of the dimension. If the dimension is named "gates", you can first call status = nf90_inq_dimid(ncid, "gates", GatesDimID) if (status /= nf90_noerr) ! handle error to get the dimension id, then use that in a call to status = nf90_inquire_dimension(ncid, GatesDimID, len = nGates) Now you need to declare an array dimensioned (nGates, 64). One way is like real, dimension(:, :, :), allocatable :: I_in ... allocate(I_in(nGates, 64)) Another way to do this without using allocate is by calling a subroutine with the array sizes as arguments, and inside the subroutine you can use the arguments for array dimensions of arrays local to that subroutine. If you also pass the name of the array as an argument, then you can also declare the size of the array with inside that subroutine, for example real I_in(MaxGates * 64) ... call read_I_in(I_in, nGates) ... subroutine read_I_in(arg1, arg2) real arg1(arg2, *) ... ! read data into array arg1 ... --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: AQT-176214 Department: Support netCDF Priority: Normal Status: Closed