dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4Cursor.java
long
    computeTrueOffset(Nc4Cursor f)
            throws DapException
    {
        List<Nc4Cursor> path = getCursorPath(f);
        long totaloffset = 0;
        Nc4Cursor current;

        // First element is presumed to be a structure ore record variable,
        // and that its memory covers only it's instance.
        // Walk intermediate nodes
        for(int i = 1; i < (path.size() - 1); i++) {
            current = path.get(i);
            DapVariable template = (DapVariable) current.getTemplate();
            VarNotes vi = (VarNotes) ((Nc4DSP) getDSP()).find(template);

            long size = vi.getSize();
            long offset = current.getOffset();
            long pos = 0;
            switch (current.getScheme()) {
            case SEQUENCE:
            case STRUCTURE:
                pos = current.getIndex().index();
                break;
            case RECORD:
                // readrecord will have set our memory to the start of the record
                pos = 0;
                break;
            default:
                throw new DapException("Illegal cursor type: " + current.getScheme());
            }
            long delta = size * pos + offset;
            totaloffset += delta;
        }
        assert path.get(path.size() - 1) == f;
        totaloffset += f.getOffset();
        return totaloffset;
    }
long
    computeTrueOffset(Nc4Cursor f)
            throws DapException
    {
        List<Nc4Cursor> path = getCursorPath(f);
        long totaloffset = 0;
        Nc4Cursor current;

        // First element is presumed to be a structure ore record variable,
        // and that its memory covers only it's instance.
        // Walk intermediate nodes
        for(int i = 1; i < (path.size() - 1); i++) {
            current = path.get(i);
            DapVariable template = (DapVariable) current.getTemplate();
            VarNotes vi = (VarNotes) ((Nc4DSP) getDSP()).find(template);

            long size = vi.getSize();
            long offset = current.getOffset();
            long pos = 0;
            switch (current.getScheme()) {
            case SEQUENCE:
            case STRUCTURE:
                pos = current.getIndex().index();
                break;
            case RECORD:
                // readrecord will have set our memory to the start of the record
                pos = 0;
                break;
            default:
                throw new DapException("Illegal cursor type: " + current.getScheme());
            }
            long delta = size * pos + offset;
            totaloffset += delta;
        }
        assert path.get(path.size() - 1) == f;
        totaloffset += f.getOffset();
        return totaloffset;
    }
long computeTrueOffset ( Nc4Cursor f ) throws DapException { List < Nc4Cursor > path = getCursorPath ( f ) ; long totaloffset = 0 ; Nc4Cursor current ; // First element is presumed to be a structure ore record variable, // and that its memory covers only it's instance. // Walk intermediate nodes for ( int i = 1 ; i < ( path . size ( ) - 1 ) ; i ++ ) { current = path . get ( i ) ; DapVariable template = ( DapVariable ) current . getTemplate ( ) ; VarNotes vi = ( VarNotes ) ( ( Nc4DSP ) getDSP ( ) ) . find ( template ) ; long size = vi . getSize ( ) ; long offset = current . getOffset ( ) ; long pos = 0 ; switch ( current . getScheme ( ) ) { case SEQUENCE : case STRUCTURE : pos = current . getIndex ( ) . index ( ) ; break ; case RECORD : // readrecord will have set our memory to the start of the record pos = 0 ; break ; default : throw new DapException ( "Illegal cursor type: " + current . getScheme ( ) ) ; } long delta = size * pos + offset ; totaloffset += delta ; } assert path . get ( path . size ( ) - 1 ) == f ; totaloffset += f . getOffset ( ) ; return totaloffset ; }
Given a field ref, compute the true offset with respect to
it top-level containing structure/record

@param f field cursor
@return
@throws DapException
Given a field ref compute the true offset with respect to it top - level containing structure / record