Class DapNetcdfFile

  • All Implemented Interfaces:
    Closeable, AutoCloseable, FileCacheable

    public class DapNetcdfFile
    extends NetcdfFile
    This class is the work-horse of the client side. It uses a D4DSP instance to obtain access to a DMR and (optionally) a compiled DAP4 data stream. Given that, it constructs a translation to CDM.
    • Constructor Detail

      • DapNetcdfFile

        public DapNetcdfFile​(String location,
                             CancelTask cancelTask)
                      throws IOException
        Open a Dap4 connection or file via a D4DSP. Warning: we do not use a Builder because this object is mutable over time.
        Parameters:
        location - URL for the request. Note that if this is intended to send to a file oriented DSP, then if must be converted to an absolute path. Note also that the URL path should not have any .dap or .dmr extension since using those is the purview of this class.
        cancelTask - check if task is cancelled; may be null.
        Throws:
        IOException
      • DapNetcdfFile

        public DapNetcdfFile​(String url)
                      throws IOException
        Open a Dap4 connection
        Parameters:
        url - URL for the request.
        Throws:
        IOException
    • Method Detail

      • isconstrainable

        public boolean isconstrainable()
        Returns:
        true if we can ask the server to do constraint processing
      • getDSP

        public D4DSP getDSP()
      • readArrays

        public List<Array> readArrays​(List<Variable> variables)
                               throws IOException
        Do a bulk read on a list of Variables and return a corresponding list of Array that contains the results of a full read on each Variable. TODO: optimize to make only a single server call and cache the results.
        Overrides:
        readArrays in class NetcdfFile
        Parameters:
        variables - List of type Variable
        Returns:
        List of Array, one for each Variable in the input.
        Throws:
        IOException - if read error
      • readToByteChannel

        public long readToByteChannel​(Variable v,
                                      Section section,
                                      WritableByteChannel channel)
                               throws IOException,
                                      InvalidRangeException
        Read databuffer from a top level Variable and send databuffer to a WritableByteChannel. Experimental.
        Overrides:
        readToByteChannel in class NetcdfFile
        Parameters:
        v - a top-level Variable
        section - the section of databuffer to read. There must be a Range for each Dimension in the variable, in order. Note: no nulls allowed. IOSP may not modify.
        channel - write databuffer to this WritableByteChannel
        Returns:
        the number of databuffer written to the channel
        Throws:
        IOException - if read error
        InvalidRangeException - if invalid section
      • readData

        protected Array readData​(Variable cdmvar,
                                 Section section)
                          throws IOException,
                                 InvalidRangeException
        b * Primary read entry point. This is the primary implementor of Variable.read.
        Overrides:
        readData in class NetcdfFile
        Parameters:
        cdmvar - A top-level variable
        section - the section of databuffer to read. There must be a Range for each Dimension in the variable, in order. Note: no nulls allowed.
        Returns:
        An Array object for accessing the databuffer
        Throws:
        IOException - if read error
        InvalidRangeException - if invalid section
      • loadContext

        protected void loadContext()
      • ensuredmr

        public void ensuredmr()
                       throws IOException
        Do what is necessary to ensure that DMR and DAP compilation will work
        Throws:
        IOException