Class BufrDataInfo
- java.lang.Object
-
- org.meteoinfo.data.meteodata.bufr.BufrDataInfo
-
public class BufrDataInfo extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static int[]BIT_MASK
-
Constructor Summary
Constructors Constructor Description BufrDataInfo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseDataFile()Close the data file created by previos stepvoidcreateDataFile(java.lang.String fileName)Create Bufr binary data fileucar.nc2.iosp.bufr.MessagereadFirstMessage(java.lang.String fileName)Read first messagevoidreWriteDataSectionHead(int len)Write data section headvoidreWriteIndicatorSection(int bufrLength, int edition)Write indicator sectionprotected static voidsetBit(int bit, byte[] bytes)byte[]toByteArray(java.util.BitSet bs)intwrite(int value, int nbits)Write a int valueintwrite(java.lang.String des, int value)Write a int valueintwrite(java.util.List<java.lang.Integer> values, java.util.List<java.lang.Integer> nbits)Write int valuesintwriteDataDescriptionSection(int ndatasets, int datatype, java.util.List<java.lang.String> descriptors)Write data description sectionintwriteDataSectionHead(int len)Write data section headintwriteEndSection()Write end sectionintwriteIdentificationSection(int len, int master_table, int subcenter_id, int center_id, int update_sequence, int optional, int category, int sub_category, int master_table_version, int local_table_version, int year, int month, int day, int hour, int minute)Write identification sectionintwriteIndicatorSection(int bufrLength, int edition)Write indicator section
-
-
-
Method Detail
-
readFirstMessage
public ucar.nc2.iosp.bufr.Message readFirstMessage(java.lang.String fileName) throws java.io.FileNotFoundException, java.io.IOExceptionRead first message- Parameters:
fileName- Bufr File Name- Returns:
- First message
- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
createDataFile
public void createDataFile(java.lang.String fileName)
Create Bufr binary data file- Parameters:
fileName- File name
-
closeDataFile
public void closeDataFile()
Close the data file created by previos step
-
writeIndicatorSection
public int writeIndicatorSection(int bufrLength, int edition) throws java.io.IOExceptionWrite indicator section- Parameters:
bufrLength- The total length of the messageedition- Bufr edition- Returns:
- Indicator section length
- Throws:
java.io.IOException
-
reWriteIndicatorSection
public void reWriteIndicatorSection(int bufrLength, int edition) throws java.io.IOExceptionWrite indicator section- Parameters:
bufrLength- The total length of the messageedition- Bufr edition- Throws:
java.io.IOException
-
writeIdentificationSection
public int writeIdentificationSection(int len, int master_table, int subcenter_id, int center_id, int update_sequence, int optional, int category, int sub_category, int master_table_version, int local_table_version, int year, int month, int day, int hour, int minute) throws java.io.IOExceptionWrite identification section- Parameters:
len- Section lengthmaster_table- Master tablesubcenter_id- Subcenter idcenter_id- Center idupdate_sequence- Update sequencyoptional- Optionalcategory- Categorysub_category- Sub categorymaster_table_version- Master table versionlocal_table_version- Local table versionyear- Yearmonth- Monthday- Dayhour- Hourminute- Minute- Returns:
- Section length
- Throws:
java.io.IOException
-
writeDataDescriptionSection
public int writeDataDescriptionSection(int ndatasets, int datatype, java.util.List<java.lang.String> descriptors) throws java.io.IOExceptionWrite data description section- Parameters:
ndatasets- Number of datasetsdatatype- Data typedescriptors- Data descriptors- Returns:
- Section length
- Throws:
java.io.IOException
-
writeDataSectionHead
public int writeDataSectionHead(int len) throws java.io.IOExceptionWrite data section head- Parameters:
len- Length- Returns:
- Data section head length
- Throws:
java.io.IOException
-
reWriteDataSectionHead
public void reWriteDataSectionHead(int len) throws java.io.IOExceptionWrite data section head- Parameters:
len- Length- Throws:
java.io.IOException
-
write
public int write(int value, int nbits) throws java.io.IOExceptionWrite a int value- Parameters:
value- Valuenbits- bit number- Returns:
- Data length
- Throws:
java.io.IOException
-
write
public int write(java.lang.String des, int value) throws java.io.IOExceptionWrite a int value- Parameters:
value- Valuedes- Data descriptor string- Returns:
- Data length
- Throws:
java.io.IOException
-
write
public int write(java.util.List<java.lang.Integer> values, java.util.List<java.lang.Integer> nbits) throws java.io.IOExceptionWrite int values- Parameters:
values- Valuesnbits- bit numbers- Returns:
- Data length
- Throws:
java.io.IOException
-
toByteArray
public byte[] toByteArray(java.util.BitSet bs)
-
setBit
protected static void setBit(int bit, byte[] bytes)
-
writeEndSection
public int writeEndSection() throws java.io.IOExceptionWrite end section- Returns:
- End section length
- Throws:
java.io.IOException
-
-