File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,13 @@ This page provides an overview of available variables.
29
29
you can use :external:py:meth: `logging.getLogger("imaspy").setLevel(...)
30
30
<logging.Logger.setLevel> ` to change the log level programmatically.
31
31
32
+
33
+ ``IMASPY_DISABLE_NC_VALIDATE ``
34
+ Disables validation of netCDF files when loading an IDS from an IMAS netCDF file.
35
+
36
+ .. caution ::
37
+ Disabling the validation may lead to errors when reading data from an IMAS netCDF file.
38
+
32
39
``IMAS_VERSION ``
33
40
Sets :ref: `The default Data Dictionary version ` to use.
34
41
Original file line number Diff line number Diff line change 1
1
import logging
2
+ import os
2
3
from typing import Iterator , List , Optional , Tuple
3
4
4
5
import netCDF4
@@ -163,6 +164,14 @@ def run(self) -> None:
163
164
164
165
def _validate_variables (self ) -> None :
165
166
"""Validate that all variables in the netCDF Group exist and match the DD."""
167
+ disable_validate = os .environ .get ("IMASPY_DISABLE_NC_VALIDATE" )
168
+ if disable_validate and disable_validate != "0" :
169
+ logger .info (
170
+ "NetCDF file validation disabled: "
171
+ "This may lead to errors when reading data!"
172
+ )
173
+ return # validation checks are disabled
174
+
166
175
for var_name in self .variables :
167
176
if var_name .endswith (":shape" ):
168
177
# Check that there is a corresponding variable
You can’t perform that action at this time.
0 commit comments