make UDF0 not require NC_NETCDF4
@@ -118,7 +118,7 @@ static struct FORMATMODES {
{"classic",NC_FORMATX_NC3,0}, /* ditto */
{"netcdf-4",NC_FORMATX_NC4,NC_FORMAT_NETCDF4},
{"enhanced",NC_FORMATX_NC4,NC_FORMAT_NETCDF4},
-{"udf0",NC_FORMATX_UDF0,NC_FORMAT_NETCDF4},
+{"udf0",NC_FORMATX_UDF0,0},
{"udf1",NC_FORMATX_UDF1,NC_FORMAT_NETCDF4},
{"nczarr",NC_FORMATX_NCZARR,NC_FORMAT_NETCDF4},
{"zarr",NC_FORMATX_NCZARR,NC_FORMAT_NETCDF4},
@@ -762,13 +762,28 @@ NC_omodeinfer(int useparallel, int cmode, NCmodel* model)
* use some of the other flags, like NC_NETCDF4, so we must first
* check NC_UDF0 and NC_UDF1 before checking for any other
* flag. */
- if(fIsSet(cmode,(NC_UDF0|NC_UDF1))) {
- model->format = NC_FORMAT_NETCDF4;
if(fIsSet(cmode, NC_UDF0)) {
model->impl = NC_FORMATX_UDF0;
- } else {
- model->impl = NC_FORMATX_UDF1;
+ if(fIsSet(cmode,NC_64BIT_OFFSET)) {
+ model->format = NC_FORMAT_64BIT_OFFSET;
+ }
+ else if(fIsSet(cmode,NC_64BIT_DATA)) {
+ model->format = NC_FORMAT_64BIT_DATA;
+ }
+ else if(fIsSet(cmode,NC_NETCDF4)) {
+ if(fIsSet(cmode,NC_CLASSIC_MODEL))
+ model->format = NC_FORMAT_NETCDF4_CLASSIC;
+ else
+ model->format = NC_FORMAT_NETCDF4;
}
+ if(! model->format)
+ model->format = NC_FORMAT_CLASSIC;
+ goto done;
+ }
+
+ if(fIsSet(cmode,(NC_UDF1))) {
+ model->format = NC_FORMAT_NETCDF4;
+ model->impl = NC_FORMATX_UDF1;
goto done;
}
@@ -981,7 +996,6 @@ NC_infermodel(const char* path, int* omodep, int iscreate, int useparallel, void
case NC_FORMATX_NC4:
case NC_FORMATX_NC_HDF4:
case NC_FORMATX_DAP4:
- case NC_FORMATX_UDF0:
case NC_FORMATX_UDF1:
case NC_FORMATX_NCZARR:
omode |= NC_NETCDF4;
@@ -1001,6 +1015,12 @@ NC_infermodel(const char* path, int* omodep, int iscreate, int useparallel, void
case NC_FORMATX_DAP2:
omode &= ~(NC_NETCDF4|NC_64BIT_OFFSET|NC_64BIT_DATA|NC_CLASSIC_MODEL);
break;
+ case NC_FORMATX_UDF0:
+ if(model->format == NC_FORMAT_64BIT_OFFSET) omode |= NC_64BIT_OFFSET;
+ else if(model->format == NC_FORMAT_64BIT_DATA) omode |= NC_64BIT_DATA;
+ else if(model->format == NC_FORMAT_NETCDF4) omode |= NC_NETCDF4;
+ else if(model->format == NC_FORMAT_NETCDF4_CLASSIC) omode |= NC_NETCDF4|NC_CLASSIC_MODEL;
+ break;
default:
{stat = NC_ENOTNC; goto done;}
}
