int pcode_128 ( int [ ] pos , int [ ] size , int code , int hoff , int len , String structName , String abbre , boolean isZ ) { //int vlen = len; ArrayList dims = new ArrayList ( ) ; Dimension sDim = new Dimension ( "textStringSize" + abbre + code , len ) ; ncfile . addDimension ( null , sDim ) ; dims . add ( sDim ) ; Structure dist = new Structure ( ncfile , null , null , structName + abbre ) ; dist . setDimensions ( dims ) ; ncfile . addVariable ( null , dist ) ; dist . addAttribute ( new Attribute ( CDM . LONG_NAME , "text and special symbol for code " + code ) ) ; if ( code == 8 ) { Variable strVal = new Variable ( ncfile , null , dist , "strValue" ) ; strVal . setDimensions ( ( String ) null ) ; strVal . setDataType ( DataType . SHORT ) ; strVal . addAttribute ( new Attribute ( CDM . UNITS , "" ) ) ; dist . addMemberVariable ( strVal ) ; } Variable i0 = new Variable ( ncfile , null , dist , "x_start" ) ; i0 . setDimensions ( ( String ) null ) ; i0 . setDataType ( DataType . SHORT ) ; i0 . addAttribute ( new Attribute ( CDM . UNITS , "KM" ) ) ; dist . addMemberVariable ( i0 ) ; Variable j0 = new Variable ( ncfile , null , dist , "y_start" ) ; j0 . setDimensions ( ( String ) null ) ; j0 . setDataType ( DataType . SHORT ) ; j0 . addAttribute ( new Attribute ( CDM . UNITS , "KM" ) ) ; dist . addMemberVariable ( j0 ) ; Variable tstr = new Variable ( ncfile , null , dist , "textString" ) ; tstr . setDimensions ( ( String ) null ) ; tstr . setDataType ( DataType . STRING ) ; tstr . addAttribute ( new Attribute ( CDM . UNITS , "" ) ) ; dist . addMemberVariable ( tstr ) ; int [ ] pos1 = new int [ len ] ; System . arraycopy ( pos , 0 , pos1 , 0 , len ) ; dist . setSPobject ( new Vinfo ( 0 , 0 , 0 , 0 , hoff , 0 , isR , isZ , pos1 , size , code , 0 ) ) ; return 1 ; }
construct a dataset for text and special symbol packets with code 1 2 and 8