legacy/src/main/java/ucar/nc2/dt/grid/CFGridWriter.java
public long makeGridFileSizeEstimate(ucar.nc2.dt.GridDataset gds, List<String> gridList,
                                       LatLonRect llbb, int horizStride,
                                       Range zRange,
                                       CalendarDateRange dateRange, int stride_time,
                                       boolean addLatLon) throws IOException, InvalidRangeException {

    return makeOrTestSize(null, gds, gridList, llbb, horizStride, zRange, dateRange, stride_time, addLatLon, true, NetcdfFileWriter.Version.netcdf3);
  }
public long makeGridFileSizeEstimate(ucar.nc2.dt.GridDataset gds, List<String> gridList,
                                       LatLonRect llbb, int horizStride,
                                       Range zRange,
                                       CalendarDateRange dateRange, int stride_time,
                                       boolean addLatLon) throws IOException, InvalidRangeException {

    return makeOrTestSize(null, gds, gridList, llbb, horizStride, zRange, dateRange, stride_time, addLatLon, true, NetcdfFileWriter.Version.netcdf3);
  }
Write a netcdf-3 file from a subset of a grid dataset, as long as it doesnt exceed a certain file size.

@param gds         from this grid dataset
@param gridList    just these grids
@param llbb        horiz subset, may be null
@param zRange      vertical subset, may be null
@param dateRange   time subset, may be null
@param stride_time time may be strided, -1 if want all
@param addLatLon   optionally add a lat/lon coordinate (if dataset uses projection coords)
@return file size
@throws IOException
@throws InvalidRangeException