Skip to content

Commit

Permalink
fix CF version and min/max dates
Browse files Browse the repository at this point in the history
  • Loading branch information
Hailey Johnson committed Jul 9, 2024
1 parent 5d13f44 commit 2ff52bb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
* <li>netcdf3: use indexed ragged array representation</li>
* </ul>
*/
@Deprecated
public abstract class CFPointWriter implements Closeable {
private static final Logger logger = LoggerFactory.getLogger(CFPointWriter.class);
private static final String CF_VERSION = "CF-1.9";
Expand Down Expand Up @@ -861,6 +860,12 @@ public void finish() throws IOException {
writer.updateAttribute(null, new Attribute(ACDD.LON_MIN, llbb.getLowerLeftPoint().getLongitude()));
writer.updateAttribute(null, new Attribute(ACDD.LON_MAX, llbb.getUpperRightPoint().getLongitude()));
}
if (minDate == null)
minDate = CalendarDate.present();
if (maxDate == null)
maxDate = CalendarDate.present();
writer.updateAttribute(null, new Attribute(ACDD.TIME_START, CalendarDateFormatter.toDateTimeStringISO(minDate)));
writer.updateAttribute(null, new Attribute(ACDD.TIME_END, CalendarDateFormatter.toDateTimeStringISO(maxDate)));

writer.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class WriterCFPointCollection extends CFPointWriter {
public WriterCFPointCollection(String fileOut, List<Attribute> globalAtts, List<VariableSimpleIF> dataVars,
CalendarDateUnit timeUnit, String altUnits, CFPointWriterConfig config) throws IOException {
super(fileOut, globalAtts, dataVars, timeUnit, altUnits, config);
writer.addGroupAttribute(null, new Attribute(CF.FEATURE_TYPE, CF.FeatureType.point.name()));
writer.addGroupAttribute(null, new Attribute(CF.DSG_REPRESENTATION, "Point Data, H.1"));
}

public WriterCFPointCollection(String fileOut, List<Attribute> globalAtts, List<VariableSimpleIF> dataVars,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
abstract class WriterCFPointAbstract implements Closeable {
private static final Logger logger = LoggerFactory.getLogger(WriterCFPointAbstract.class);

private static final String CF_VERSION = "CF-1.9";

static final String recordName = "obs";
static final String recordDimName = "obs";
static final String latName = "latitude";
Expand Down Expand Up @@ -126,7 +128,7 @@ abstract class WriterCFPointAbstract implements Closeable {
}

private void addGlobalAtts(AttributeContainer atts) {
writerb.addAttribute(new Attribute(CDM.CONVENTIONS, isExtendedModel ? CDM.CF_EXTENDED : "CF-1.6"));
writerb.addAttribute(new Attribute(CDM.CONVENTIONS, isExtendedModel ? CDM.CF_EXTENDED : CF_VERSION));
writerb.addAttribute(new Attribute(CDM.HISTORY, "Written by CFPointWriter"));
for (Attribute att : atts) {
if (!reservedGlobalAtts.contains(att.getShortName()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import ucar.unidata.util.StringUtil2;

/**
* Write DSG CF-1.6 file from a Coverage Dataset
* Write DSG CF-1.9 file from a Coverage Dataset
*
* @author caron
* @since 7/8/2015
Expand Down

0 comments on commit 2ff52bb

Please sign in to comment.