@ Override public void open ( RandomAccessFile raff , NetcdfFile ncfile , CancelTask cancelTask ) throws IOException { super . open ( raff , ncfile , cancelTask ) ; int pos = location . lastIndexOf ( "." ) ; String ext = location . substring ( pos ) ; File file = new File ( location ) ; File stnFile = getStnFile ( location ) ; if ( stnFile == null ) throw new FileNotFoundException ( "Station File does not exist=" + location ) ; if ( ext . equals ( IDX_EXT ) ) { stnRaf = RandomAccessFile . acquire ( stnFile . getPath ( ) ) ; } else if ( ext . equals ( DAT_EXT ) ) { stnRaf = RandomAccessFile . acquire ( stnFile . getPath ( ) ) ; dataRaf = raff ; //extract the station id String name = file . getName ( ) ; stationId = name . substring ( 0 , name . length ( ) - DAT_EXT . length ( ) ) ; } else { // pointed to the station file stnRaf = raff ; dataDir = new File ( file . getParentFile ( ) , DAT_DIR ) ; } NcmlConstructor ncmlc = new NcmlConstructor ( ) ; if ( ! ncmlc . populateFromResource ( "resources/nj22/iosp/igra-por.ncml" , ncfile ) ) { throw new IllegalStateException ( ncmlc . getErrlog ( ) . toString ( ) ) ; } ncfile . finish ( ) ; //dataVinfo = setVinfo(dataRaf, ncfile, dataPattern, "all_data"); stnVinfo = setVinfo ( stnRaf , ncfile , stnPattern , "station" ) ; seriesVinfo = setVinfo ( stnRaf , ncfile , dataHeaderPattern , "station.time_series" ) ; profileVinfo = setVinfo ( stnRaf , ncfile , dataPattern , "station.time_series.levels" ) ; StructureMembers . Member m = stnVinfo . sm . findMember ( STNID ) ; StructureDataRegexp . VinfoField f = ( StructureDataRegexp . VinfoField ) m . getDataObject ( ) ; stn_fldno = f . fldno ; /* make index file if needed File idxFile = new File(base + IDX_EXT); if (!idxFile.exists()) makeIndex(stnVinfo, dataVinfo, idxFile); else readIndex(idxFile.getPath()); */ }
if a DAT file