cdm/src/main/java/ucar/nc2/iosp/sigmet/SigmetIOServiceProvider.java
static public java.util.Map<String, Number> readRecordsHdr(ucar.unidata.io.RandomAccessFile raf) {
    java.util.Map<String, Number> recHdr1 = new java.util.HashMap<String, Number>();
    try {
      int nparams = 0;
      //      -- Read from <product_end> of the 1st record -- 12+320+120
      //      -- Calculate Nyquist velocity --------------------
      raf.seek(452);
      int prf = raf.readInt();
      raf.seek(480);
      int wave = raf.readInt();
      float vNyq = calcNyquist(prf, wave);
      recHdr1.put("vNyq", vNyq);

      //      -- Read from the 2nd record----------- 6144+12(strucr_hdr)+168(from ingest_config)
      raf.seek(6324);
      int radar_lat = raf.readInt();
      int radar_lon = raf.readInt();           //6328
      short ground_height = raf.readShort();  //6332
      short radar_height = raf.readShort();   //6334
      raf.skipBytes(4);
      short num_rays = raf.readShort();      // 6340
      raf.skipBytes(2);
      int radar_alt = raf.readInt();          //6344
      raf.seek(6648);
      int time_beg = raf.readInt();
      raf.seek(6652);
      int time_end = raf.readInt();
      raf.seek(6772);
      int data_mask = raf.readInt();
      for (int j = 0; j < 32; j++) {
        nparams += ((data_mask >> j) & (0x1));
      }
      raf.seek(6912);
      short multiprf = raf.readShort();
      raf.seek(7408);
      int range_first = raf.readInt();   //  cm    7408
      int range_last = raf.readInt();    //  cm  7412
      raf.skipBytes(2);
      short bins = raf.readShort();             //7418
      if (bins % 2 != 0) bins = (short) (bins + 1);
      raf.skipBytes(4);
      int step = raf.readInt();          //  cm    7424
      raf.seek(7574);
      short number_sweeps = raf.readShort();    // 7574
      raf.seek(12312);
      int base_time = raf.readInt();        //<ingest_data_header> 3d rec
      raf.skipBytes(2);
      short year = raf.readShort();
      short month = raf.readShort();
      short day = raf.readShort();
      recHdr1.put("radar_lat", calcAngle(radar_lat));
      recHdr1.put("radar_lon", calcAngle(radar_lon));
      recHdr1.put("range_first", range_first);
      recHdr1.put("range_last", range_last);
      recHdr1.put("ground_height", ground_height);
      recHdr1.put("radar_height", radar_height);
      recHdr1.put("radar_alt", radar_alt);
      recHdr1.put("step", step);
      recHdr1.put("bins", bins);    //System.out.println("  bins="+bins);
      recHdr1.put("num_rays", num_rays); //System.out.println("  rays="+num_rays);
      recHdr1.put("nparams", nparams);//System.out.println("  nparams="+nparams);
      recHdr1.put("multiprf", multiprf);
      recHdr1.put("number_sweeps", number_sweeps);   //System.out.println("IN HDR:  number_sweeps="+number_sweeps);
      recHdr1.put("year", year);
      recHdr1.put("month", month);
      recHdr1.put("day", day);
      recHdr1.put("base_time", base_time);
    } catch (Exception e) {
      System.out.println(e.toString());
      e.printStackTrace();
    }
    return recHdr1;
  }
static public java.util.Map<String, Number> readRecordsHdr(ucar.unidata.io.RandomAccessFile raf) {
    java.util.Map<String, Number> recHdr1 = new java.util.HashMap<String, Number>();
    try {
      int nparams = 0;
      //      -- Read from <product_end> of the 1st record -- 12+320+120
      //      -- Calculate Nyquist velocity --------------------
      raf.seek(452);
      int prf = raf.readInt();
      raf.seek(480);
      int wave = raf.readInt();
      float vNyq = calcNyquist(prf, wave);
      recHdr1.put("vNyq", vNyq);

      //      -- Read from the 2nd record----------- 6144+12(strucr_hdr)+168(from ingest_config)
      raf.seek(6324);
      int radar_lat = raf.readInt();
      int radar_lon = raf.readInt();           //6328
      short ground_height = raf.readShort();  //6332
      short radar_height = raf.readShort();   //6334
      raf.skipBytes(4);
      short num_rays = raf.readShort();      // 6340
      raf.skipBytes(2);
      int radar_alt = raf.readInt();          //6344
      raf.seek(6648);
      int time_beg = raf.readInt();
      raf.seek(6652);
      int time_end = raf.readInt();
      raf.seek(6772);
      int data_mask = raf.readInt();
      for (int j = 0; j < 32; j++) {
        nparams += ((data_mask >> j) & (0x1));
      }
      raf.seek(6912);
      short multiprf = raf.readShort();
      raf.seek(7408);
      int range_first = raf.readInt();   //  cm    7408
      int range_last = raf.readInt();    //  cm  7412
      raf.skipBytes(2);
      short bins = raf.readShort();             //7418
      if (bins % 2 != 0) bins = (short) (bins + 1);
      raf.skipBytes(4);
      int step = raf.readInt();          //  cm    7424
      raf.seek(7574);
      short number_sweeps = raf.readShort();    // 7574
      raf.seek(12312);
      int base_time = raf.readInt();        //<ingest_data_header> 3d rec
      raf.skipBytes(2);
      short year = raf.readShort();
      short month = raf.readShort();
      short day = raf.readShort();
      recHdr1.put("radar_lat", calcAngle(radar_lat));
      recHdr1.put("radar_lon", calcAngle(radar_lon));
      recHdr1.put("range_first", range_first);
      recHdr1.put("range_last", range_last);
      recHdr1.put("ground_height", ground_height);
      recHdr1.put("radar_height", radar_height);
      recHdr1.put("radar_alt", radar_alt);
      recHdr1.put("step", step);
      recHdr1.put("bins", bins);    //System.out.println("  bins="+bins);
      recHdr1.put("num_rays", num_rays); //System.out.println("  rays="+num_rays);
      recHdr1.put("nparams", nparams);//System.out.println("  nparams="+nparams);
      recHdr1.put("multiprf", multiprf);
      recHdr1.put("number_sweeps", number_sweeps);   //System.out.println("IN HDR:  number_sweeps="+number_sweeps);
      recHdr1.put("year", year);
      recHdr1.put("month", month);
      recHdr1.put("day", day);
      recHdr1.put("base_time", base_time);
    } catch (Exception e) {
      System.out.println(e.toString());
      e.printStackTrace();
    }
    return recHdr1;
  }
static public java . util . Map < String , Number > readRecordsHdr ( ucar . unidata . io . RandomAccessFile raf ) { java . util . Map < String , Number > recHdr1 = new java . util . HashMap < String , Number > ( ) ; try { int nparams = 0 ; //      -- Read from <product_end> of the 1st record -- 12+320+120
 //      -- Calculate Nyquist velocity --------------------
 raf . seek ( 452 ) ; int prf = raf . readInt ( ) ; raf . seek ( 480 ) ; int wave = raf . readInt ( ) ; float vNyq = calcNyquist ( prf , wave ) ; recHdr1 . put ( "vNyq" , vNyq ) ; //      -- Read from the 2nd record----------- 6144+12(strucr_hdr)+168(from ingest_config)
 raf . seek ( 6324 ) ; int radar_lat = raf . readInt ( ) ; int radar_lon = raf . readInt ( ) ; //6328
 short ground_height = raf . readShort ( ) ; //6332
 short radar_height = raf . readShort ( ) ; //6334
 raf . skipBytes ( 4 ) ; short num_rays = raf . readShort ( ) ; // 6340
 raf . skipBytes ( 2 ) ; int radar_alt = raf . readInt ( ) ; //6344
 raf . seek ( 6648 ) ; int time_beg = raf . readInt ( ) ; raf . seek ( 6652 ) ; int time_end = raf . readInt ( ) ; raf . seek ( 6772 ) ; int data_mask = raf . readInt ( ) ; for ( int j = 0 ; j < 32 ; j ++ ) { nparams += ( ( data_mask >> j ) & ( 0x1 ) ) ; } raf . seek ( 6912 ) ; short multiprf = raf . readShort ( ) ; raf . seek ( 7408 ) ; int range_first = raf . readInt ( ) ; //  cm    7408
 int range_last = raf . readInt ( ) ; //  cm  7412
 raf . skipBytes ( 2 ) ; short bins = raf . readShort ( ) ; //7418
 if ( bins % 2 != 0 ) bins = ( short ) ( bins + 1 ) ; raf . skipBytes ( 4 ) ; int step = raf . readInt ( ) ; //  cm    7424
 raf . seek ( 7574 ) ; short number_sweeps = raf . readShort ( ) ; // 7574
 raf . seek ( 12312 ) ; int base_time = raf . readInt ( ) ; //<ingest_data_header> 3d rec
 raf . skipBytes ( 2 ) ; short year = raf . readShort ( ) ; short month = raf . readShort ( ) ; short day = raf . readShort ( ) ; recHdr1 . put ( "radar_lat" , calcAngle ( radar_lat ) ) ; recHdr1 . put ( "radar_lon" , calcAngle ( radar_lon ) ) ; recHdr1 . put ( "range_first" , range_first ) ; recHdr1 . put ( "range_last" , range_last ) ; recHdr1 . put ( "ground_height" , ground_height ) ; recHdr1 . put ( "radar_height" , radar_height ) ; recHdr1 . put ( "radar_alt" , radar_alt ) ; recHdr1 . put ( "step" , step ) ; recHdr1 . put ( "bins" , bins ) ; //System.out.println("  bins="+bins);
 recHdr1 . put ( "num_rays" , num_rays ) ; //System.out.println("  rays="+num_rays);
 recHdr1 . put ( "nparams" , nparams ) ; //System.out.println("  nparams="+nparams);
 recHdr1 . put ( "multiprf" , multiprf ) ; recHdr1 . put ( "number_sweeps" , number_sweeps ) ; //System.out.println("IN HDR:  number_sweeps="+number_sweeps);
 recHdr1 . put ( "year" , year ) ; recHdr1 . put ( "month" , month ) ; recHdr1 . put ( "day" , day ) ; recHdr1 . put ( "base_time" , base_time ) ; } catch ( Exception e ) { System . out . println ( e . toString ( ) ) ; e . printStackTrace ( ) ; } return recHdr1 ; }
Read some global data from SIGMET file. The SIGMET file consists of records with
fixed length=6144 bytes.
Read some global data from SIGMET file . The SIGMET file consists of records with fixed length = 6144 bytes .