@@ -42,26 +42,11 @@ class BufrIospBuilder {
4242
4343 // global Attributes
4444 AttributeContainerMutable atts = root .getAttributeContainer ();
45- atts .addAttribute (CDM .HISTORY , "Read using CDM BufrIosp2" );
45+ addCommonGlobalAttributes (atts , proto , location );
46+
4647 if (bufrConfig .getFeatureType () != null ) {
4748 atts .addAttribute (CF .FEATURE_TYPE , bufrConfig .getFeatureType ().toString ());
4849 }
49- atts .addAttribute ("location" , location );
50-
51- atts .addAttribute ("BUFR:categoryName" , proto .getLookup ().getCategoryName ());
52- atts .addAttribute ("BUFR:subCategoryName" , proto .getLookup ().getSubCategoryName ());
53- atts .addAttribute ("BUFR:centerName" , proto .getLookup ().getCenterName ());
54- atts .addAttribute ("BUFR:category" , proto .ids .getCategory ());
55- atts .addAttribute ("BUFR:subCategory" , proto .ids .getSubCategory ());
56- atts .addAttribute ("BUFR:localSubCategory" , proto .ids .getLocalSubCategory ());
57- atts .addAttribute (BufrIosp2 .centerId , proto .ids .getCenterId ());
58- atts .addAttribute ("BUFR:subCenter" , proto .ids .getSubCenterId ());
59- atts .addAttribute ("BUFR:table" , proto .ids .getMasterTableId ());
60- atts .addAttribute ("BUFR:tableVersion" , proto .ids .getMasterTableVersion ());
61- atts .addAttribute ("BUFR:localTableVersion" , proto .ids .getLocalTableVersion ());
62- atts .addAttribute ("Conventions" , "BUFR/CDM" );
63- atts .addAttribute ("BUFR:edition" , proto .is .getBufrEdition ());
64-
6550
6651 String header = proto .getHeader ();
6752 if (header != null && !header .isEmpty ()) {
@@ -80,12 +65,30 @@ class BufrIospBuilder {
8065
8166 // global Attributes
8267 AttributeContainerMutable atts = root .getAttributeContainer ();
68+ addCommonGlobalAttributes (atts , proto , location );
69+
70+ for (BufrConfig bufrConfig : bufrConfigs ) {
71+ String varName = proto .getLookup ().getCategoryName (bufrConfig .getMessage ().ids .getCategory ());
72+ Sequence .Builder rs = Sequence .builder ().setName (varName );
73+ this .rootGroup .addVariable (rs );
74+ makeObsRecord (bufrConfig , rs );
75+ String coordS = coordinates .toString ();
76+ if (!coordS .isEmpty ()) {
77+ rs .addAttribute (new Attribute ("coordinates" , coordS ));
78+ }
79+ }
80+ }
81+
82+ private void addCommonGlobalAttributes (AttributeContainerMutable atts , Message proto , String location ) {
8383 atts .addAttribute (CDM .HISTORY , "Read using CDM BufrIosp2" );
8484 atts .addAttribute ("location" , location );
8585
8686 atts .addAttribute ("BUFR:categoryName" , proto .getLookup ().getCategoryName ());
8787 atts .addAttribute ("BUFR:subCategoryName" , proto .getLookup ().getSubCategoryName ());
8888 atts .addAttribute ("BUFR:centerName" , proto .getLookup ().getCenterName ());
89+ atts .addAttribute ("BUFR:category" , proto .ids .getCategory ());
90+ atts .addAttribute ("BUFR:subCategory" , proto .ids .getSubCategory ());
91+ atts .addAttribute ("BUFR:localSubCategory" , proto .ids .getLocalSubCategory ());
8992 atts .addAttribute (BufrIosp2 .centerId , proto .ids .getCenterId ());
9093 atts .addAttribute ("BUFR:subCenter" , proto .ids .getSubCenterId ());
9194 atts .addAttribute ("BUFR:table" , proto .ids .getMasterTableId ());
@@ -98,17 +101,6 @@ class BufrIospBuilder {
98101 if (header != null && !header .isEmpty ()) {
99102 atts .addAttribute ("WMO Header" , header );
100103 }
101-
102- for (BufrConfig bufrConfig : bufrConfigs ) {
103- String varName = proto .getLookup ().getCategoryName (bufrConfig .getMessage ().ids .getCategory ());
104- Sequence .Builder rs = Sequence .builder ().setName (varName );
105- this .rootGroup .addVariable (rs );
106- makeObsRecord (bufrConfig , rs );
107- String coordS = coordinates .toString ();
108- if (!coordS .isEmpty ()) {
109- rs .addAttribute (new Attribute ("coordinates" , coordS ));
110- }
111- }
112104 }
113105
114106 Sequence .Builder getObsStructure () {
0 commit comments