Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 20 additions & 28 deletions bufr/src/main/java/ucar/nc2/iosp/bufr/BufrIospBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,11 @@ class BufrIospBuilder {

// global Attributes
AttributeContainerMutable atts = root.getAttributeContainer();
atts.addAttribute(CDM.HISTORY, "Read using CDM BufrIosp2");
addCommonGlobalAttributes(atts, proto, location);

if (bufrConfig.getFeatureType() != null) {
atts.addAttribute(CF.FEATURE_TYPE, bufrConfig.getFeatureType().toString());
}
atts.addAttribute("location", location);

atts.addAttribute("BUFR:categoryName", proto.getLookup().getCategoryName());
atts.addAttribute("BUFR:subCategoryName", proto.getLookup().getSubCategoryName());
atts.addAttribute("BUFR:centerName", proto.getLookup().getCenterName());
atts.addAttribute("BUFR:category", proto.ids.getCategory());
atts.addAttribute("BUFR:subCategory", proto.ids.getSubCategory());
atts.addAttribute("BUFR:localSubCategory", proto.ids.getLocalSubCategory());
atts.addAttribute(BufrIosp2.centerId, proto.ids.getCenterId());
atts.addAttribute("BUFR:subCenter", proto.ids.getSubCenterId());
atts.addAttribute("BUFR:table", proto.ids.getMasterTableId());
atts.addAttribute("BUFR:tableVersion", proto.ids.getMasterTableVersion());
atts.addAttribute("BUFR:localTableVersion", proto.ids.getLocalTableVersion());
atts.addAttribute("Conventions", "BUFR/CDM");
atts.addAttribute("BUFR:edition", proto.is.getBufrEdition());


String header = proto.getHeader();
if (header != null && !header.isEmpty()) {
Expand All @@ -80,12 +65,30 @@ class BufrIospBuilder {

// global Attributes
AttributeContainerMutable atts = root.getAttributeContainer();
addCommonGlobalAttributes(atts, proto, location);

for (BufrConfig bufrConfig : bufrConfigs) {
String varName = proto.getLookup().getCategoryName(bufrConfig.getMessage().ids.getCategory());
Sequence.Builder rs = Sequence.builder().setName(varName);
this.rootGroup.addVariable(rs);
makeObsRecord(bufrConfig, rs);
String coordS = coordinates.toString();
if (!coordS.isEmpty()) {
rs.addAttribute(new Attribute("coordinates", coordS));
}
}
}

private void addCommonGlobalAttributes(AttributeContainerMutable atts, Message proto, String location) {
atts.addAttribute(CDM.HISTORY, "Read using CDM BufrIosp2");
atts.addAttribute("location", location);

atts.addAttribute("BUFR:categoryName", proto.getLookup().getCategoryName());
atts.addAttribute("BUFR:subCategoryName", proto.getLookup().getSubCategoryName());
atts.addAttribute("BUFR:centerName", proto.getLookup().getCenterName());
atts.addAttribute("BUFR:category", proto.ids.getCategory());
atts.addAttribute("BUFR:subCategory", proto.ids.getSubCategory());
atts.addAttribute("BUFR:localSubCategory", proto.ids.getLocalSubCategory());
atts.addAttribute(BufrIosp2.centerId, proto.ids.getCenterId());
atts.addAttribute("BUFR:subCenter", proto.ids.getSubCenterId());
atts.addAttribute("BUFR:table", proto.ids.getMasterTableId());
Expand All @@ -98,17 +101,6 @@ class BufrIospBuilder {
if (header != null && !header.isEmpty()) {
atts.addAttribute("WMO Header", header);
}

for (BufrConfig bufrConfig : bufrConfigs) {
String varName = proto.getLookup().getCategoryName(bufrConfig.getMessage().ids.getCategory());
Sequence.Builder rs = Sequence.builder().setName(varName);
this.rootGroup.addVariable(rs);
makeObsRecord(bufrConfig, rs);
String coordS = coordinates.toString();
if (!coordS.isEmpty()) {
rs.addAttribute(new Attribute("coordinates", coordS));
}
}
}

Sequence.Builder getObsStructure() {
Expand Down
2 changes: 1 addition & 1 deletion cdm/gcdm/src/test/java/ucar/gcdm/TestGcdmNetcdfFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static List<Object[]> getTestParameters() {
pathname -> pathname.getName().endsWith("nc") && !pathname.getName().startsWith("test_vlen3")
&& !pathname.getName().startsWith("test_vlen4") && !pathname.getName().startsWith("test_vlen5")
&& !pathname.getName().startsWith("test_vlen9") && !pathname.getName().startsWith("test_vlen10");
String skipStructuresWithVlens2 = "vlen/IntTimSciSamp.nc vlen/cdm_sea_soundings.nc4";
String skipStructuresWithVlens2 = "vlen/IntTimSciSamp.nc vlen/cdm_sea_soundings.nc4 2024060100_GTS_sn.0001.bufr";

TestDir.actOnAllParameterized("../../dap4/src/test/data/resources/nctestfiles/", skipStructuresWithVlens, result,
false);
Expand Down