cdm/src/main/java/ucar/nc2/iosp/nids/Nidsheader.java
int pcode_generic( ByteBuffer  bos, int hoff, int hedsiz, boolean isZ, byte[] data, short[] threshold ) throws IOException
    {
        byte[] b2 = new byte[2];
        int soff = 0;
        ArrayList dims =  new ArrayList();
        int iscale = 1;                         /* data scale                    */
        bos.get(b2, 0, 2);
        bos.get(b2, 0, 2);
        bos.get(b2, 0, 2);

        readInString(bos); // vname
        readInString(bos); // vdesp

        bos.getInt(); // code
        bos.getInt(); // type
        bos.getInt(); // time
        readInString(bos); // rnameStr

        bos.getFloat(); // lat
        bos.getFloat(); // lon
        bos.getFloat(); // height

        bos.getInt(); // vscanStartTime
        bos.getInt(); // eleScanStartTime

        float eleAngle = bos.getFloat();
        p3 = (short) eleAngle;

        bos.getInt(); // volScanNum
        bos.getInt(); // opMode
        bos.getInt(); // volPattern
        bos.getInt(); // eleNum

        bos.getDouble(); // skip 8 bytes
        parseParameters(bos);   // aa - do nothing
        List cc = parseComponents(bos);   // assuming only radial component
        if (cc == null) {
            throw new IOException("Error reading components for radial data");
        }
        int num_radials = (Integer)cc.get(1);
        int num_bin = (Integer)cc.get(0);
        float rangeToFirstBin = (Float)cc.get(2);
        int dataOffset = (Integer)cc.get(3);
        numY0 = 0;
        numY =  num_radials;
        numX0 = (int)rangeToFirstBin ; //first_bin;
        numX = num_bin;
        int nlevel = code_levelslookup( pcode );
        int [] levels;
        short radp_scale = 1000;
        hedsiz = dataOffset;
                //prod_info_size = 2 * (int) (num_bin * scale + 0.5);
        //dimensions: radial, bin
        ncfile.addAttribute(null, new Attribute("cdm_data_type", FeatureType.RADIAL.toString()));
        Dimension radialDim = new Dimension("azimuth", num_radials);
        ncfile.addDimension( null, radialDim);

        Dimension binDim = new Dimension("gate", num_bin);
        ncfile.addDimension( null, binDim);
        dims.add( radialDim);
        dims.add( binDim);

        ArrayList dims1 =  new ArrayList();
        ArrayList dims2 =  new ArrayList();
        dims1.add(radialDim);
        dims2.add(binDim);

        isR = true;

        // add elevation coordinate variable
        String vName = "elevation";
        String lName = "elevation angle in degres: 0 = parallel to pedestal base, 90 = perpendicular";
        Attribute att = new Attribute(_Coordinate.AxisType, AxisType.RadialElevation.toString());
        addParameter(vName, lName, ncfile, dims1, att, DataType.FLOAT, "degrees",hoff, hedsiz, isZ, p3);

        // add azimuth coordinate variable
        vName = "azimuth";
        lName = "azimuth angle in degrees: 0 = true north, 90 = east";
        att = new Attribute(_Coordinate.AxisType, AxisType.RadialAzimuth.toString());
        addParameter(vName, lName, ncfile, dims1, att, DataType.FLOAT, "degrees",hoff, hedsiz, isZ, 0);


        // add gate coordinate variable
        vName = "gate";
        lName = "Radial distance to the start of gate";
        att = new Attribute(_Coordinate.AxisType, AxisType.RadialDistance.toString());
        addParameter(vName, lName, ncfile, dims2, att, DataType.FLOAT, "meters",hoff, hedsiz, isZ, radp_scale);

        // add radial coordinate variable

        vName = "latitude";
        lName = "Latitude of the instrument";
        att = new Attribute(_Coordinate.AxisType, AxisType.Lat.toString());
        addParameter(vName, lName, ncfile, dims1, att, DataType.FLOAT, "degrees",hoff, hedsiz, isZ, 0);

        vName = "longitude";
        lName = "Longitude of the instrument";
        att = new Attribute(_Coordinate.AxisType, AxisType.Lon.toString());
        addParameter(vName, lName, ncfile, dims1, att, DataType.FLOAT, "degrees",hoff, hedsiz, isZ, 0);

        vName = "altitude";
        lName = "Altitude in meters (asl) of the instrument";
        att = new Attribute(_Coordinate.AxisType, AxisType.Height.toString());
        addParameter(vName, lName, ncfile, dims1, att, DataType.FLOAT, "meters",hoff, hedsiz, isZ, 0);

        vName = "rays_time";
        lName = "rays time";
        att = new Attribute(_Coordinate.AxisType, AxisType.Time.toString());
        addParameter(vName, lName, ncfile, dims1, att, DataType.DOUBLE, "milliseconds since 1970-01-01 00:00 UTC"
                ,hoff, hedsiz, isZ, 0);

        if (  pcode == 176) {
            levels = getDualpolLevels(threshold);
            iscale = 1;
        } else {
            levels = getLevels(nlevel, threshold);
        }

        Variable v = new Variable(ncfile, null, null, cname + "_RAW");
        v.setDataType(DataType.USHORT);
        v.setDimensions(dims);
        ncfile.addVariable(null, v);
        v.addAttribute( new Attribute(CDM.UNITS, cunit));
        String coordinates = "elevation azimuth gate rays_time latitude longitude altitude";
        v.addAttribute( new Attribute(_Coordinate.Axes, coordinates));
        // v.addAttribute( new Attribute(CDM.UNSIGNED, "true"));
        v.setSPobject( new Vinfo (numX, numX0, numY, numY0, hoff, hedsiz, isR, isZ, null, levels, 0, nlevel));


        if (cname.startsWith("DigitalInstantaneousPrecipitationRate") ) {
            addVariable(cname, ctitle, ncfile, dims, coordinates, DataType.FLOAT,
                    cunit, hoff, hedsiz, isZ, nlevel, levels, iscale);
        }

        return soff;
    }
int pcode_generic( ByteBuffer  bos, int hoff, int hedsiz, boolean isZ, byte[] data, short[] threshold ) throws IOException
    {
        byte[] b2 = new byte[2];
        int soff = 0;
        ArrayList dims =  new ArrayList();
        int iscale = 1;                         /* data scale                    */
        bos.get(b2, 0, 2);
        bos.get(b2, 0, 2);
        bos.get(b2, 0, 2);

        readInString(bos); // vname
        readInString(bos); // vdesp

        bos.getInt(); // code
        bos.getInt(); // type
        bos.getInt(); // time
        readInString(bos); // rnameStr

        bos.getFloat(); // lat
        bos.getFloat(); // lon
        bos.getFloat(); // height

        bos.getInt(); // vscanStartTime
        bos.getInt(); // eleScanStartTime

        float eleAngle = bos.getFloat();
        p3 = (short) eleAngle;

        bos.getInt(); // volScanNum
        bos.getInt(); // opMode
        bos.getInt(); // volPattern
        bos.getInt(); // eleNum

        bos.getDouble(); // skip 8 bytes
        parseParameters(bos);   // aa - do nothing
        List cc = parseComponents(bos);   // assuming only radial component
        if (cc == null) {
            throw new IOException("Error reading components for radial data");
        }
        int num_radials = (Integer)cc.get(1);
        int num_bin = (Integer)cc.get(0);
        float rangeToFirstBin = (Float)cc.get(2);
        int dataOffset = (Integer)cc.get(3);
        numY0 = 0;
        numY =  num_radials;
        numX0 = (int)rangeToFirstBin ; //first_bin;
        numX = num_bin;
        int nlevel = code_levelslookup( pcode );
        int [] levels;
        short radp_scale = 1000;
        hedsiz = dataOffset;
                //prod_info_size = 2 * (int) (num_bin * scale + 0.5);
        //dimensions: radial, bin
        ncfile.addAttribute(null, new Attribute("cdm_data_type", FeatureType.RADIAL.toString()));
        Dimension radialDim = new Dimension("azimuth", num_radials);
        ncfile.addDimension( null, radialDim);

        Dimension binDim = new Dimension("gate", num_bin);
        ncfile.addDimension( null, binDim);
        dims.add( radialDim);
        dims.add( binDim);

        ArrayList dims1 =  new ArrayList();
        ArrayList dims2 =  new ArrayList();
        dims1.add(radialDim);
        dims2.add(binDim);

        isR = true;

        // add elevation coordinate variable
        String vName = "elevation";
        String lName = "elevation angle in degres: 0 = parallel to pedestal base, 90 = perpendicular";
        Attribute att = new Attribute(_Coordinate.AxisType, AxisType.RadialElevation.toString());
        addParameter(vName, lName, ncfile, dims1, att, DataType.FLOAT, "degrees",hoff, hedsiz, isZ, p3);

        // add azimuth coordinate variable
        vName = "azimuth";
        lName = "azimuth angle in degrees: 0 = true north, 90 = east";
        att = new Attribute(_Coordinate.AxisType, AxisType.RadialAzimuth.toString());
        addParameter(vName, lName, ncfile, dims1, att, DataType.FLOAT, "degrees",hoff, hedsiz, isZ, 0);


        // add gate coordinate variable
        vName = "gate";
        lName = "Radial distance to the start of gate";
        att = new Attribute(_Coordinate.AxisType, AxisType.RadialDistance.toString());
        addParameter(vName, lName, ncfile, dims2, att, DataType.FLOAT, "meters",hoff, hedsiz, isZ, radp_scale);

        // add radial coordinate variable

        vName = "latitude";
        lName = "Latitude of the instrument";
        att = new Attribute(_Coordinate.AxisType, AxisType.Lat.toString());
        addParameter(vName, lName, ncfile, dims1, att, DataType.FLOAT, "degrees",hoff, hedsiz, isZ, 0);

        vName = "longitude";
        lName = "Longitude of the instrument";
        att = new Attribute(_Coordinate.AxisType, AxisType.Lon.toString());
        addParameter(vName, lName, ncfile, dims1, att, DataType.FLOAT, "degrees",hoff, hedsiz, isZ, 0);

        vName = "altitude";
        lName = "Altitude in meters (asl) of the instrument";
        att = new Attribute(_Coordinate.AxisType, AxisType.Height.toString());
        addParameter(vName, lName, ncfile, dims1, att, DataType.FLOAT, "meters",hoff, hedsiz, isZ, 0);

        vName = "rays_time";
        lName = "rays time";
        att = new Attribute(_Coordinate.AxisType, AxisType.Time.toString());
        addParameter(vName, lName, ncfile, dims1, att, DataType.DOUBLE, "milliseconds since 1970-01-01 00:00 UTC"
                ,hoff, hedsiz, isZ, 0);

        if (  pcode == 176) {
            levels = getDualpolLevels(threshold);
            iscale = 1;
        } else {
            levels = getLevels(nlevel, threshold);
        }

        Variable v = new Variable(ncfile, null, null, cname + "_RAW");
        v.setDataType(DataType.USHORT);
        v.setDimensions(dims);
        ncfile.addVariable(null, v);
        v.addAttribute( new Attribute(CDM.UNITS, cunit));
        String coordinates = "elevation azimuth gate rays_time latitude longitude altitude";
        v.addAttribute( new Attribute(_Coordinate.Axes, coordinates));
        // v.addAttribute( new Attribute(CDM.UNSIGNED, "true"));
        v.setSPobject( new Vinfo (numX, numX0, numY, numY0, hoff, hedsiz, isR, isZ, null, levels, 0, nlevel));


        if (cname.startsWith("DigitalInstantaneousPrecipitationRate") ) {
            addVariable(cname, ctitle, ncfile, dims, coordinates, DataType.FLOAT,
                    cunit, hoff, hedsiz, isZ, nlevel, levels, iscale);
        }

        return soff;
    }
construct a generic radial dataset for dualpol radial products;


@param bos, hoff, hedsiz, isZ, data, threshold

@return  soff -- not used