VTK  9.7.1
vtkNetCDFReader.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-LANL-California-USGov
4 
16 #ifndef vtkNetCDFReader_h
17 #define vtkNetCDFReader_h
18 
19 #include "vtkDataObjectAlgorithm.h"
20 #include "vtkIONetCDFModule.h" // For export macro
21 #include "vtkNetCDFAccessor.h" // For netcdf/xarray accessor
22 
23 #include "vtkSmartPointer.h" // For ivars
24 #include <string> //For std::string
25 
26 VTK_ABI_NAMESPACE_BEGIN
28 class vtkDataSet;
29 class vtkDoubleArray;
30 class vtkIntArray;
31 class vtkStdString;
32 class vtkStringArray;
33 class vtkNetCDFReaderPrivate;
34 
35 class VTKIONETCDF_EXPORT vtkNetCDFReader : public vtkDataObjectAlgorithm
36 {
37 public:
39  static vtkNetCDFReader* New();
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
42  virtual void SetFileName(VTK_FILEPATH const char* filename);
43  vtkGetFilePathMacro(FileName);
45  vtkSetObjectMacro(Accessor, vtkNetCDFAccessor);
46  vtkGetObjectMacro(Accessor, vtkNetCDFAccessor);
48 
53  int UpdateMetaData();
54 
55  // // Description:
56  // // Get the data array selection tables used to configure which variables to
57  // // load.
58  // vtkGetObjectMacro(VariableArraySelection, vtkDataArraySelection);
59 
61 
64  virtual int GetNumberOfVariableArrays();
65  virtual const char* GetVariableArrayName(int index);
66  virtual int GetVariableArrayStatus(const char* name);
67  virtual void SetVariableArrayStatus(const char* name, int status);
69 
75  virtual vtkStringArray* GetAllVariableArrayNames();
76 
78 
84  vtkGetObjectMacro(VariableDimensions, vtkStringArray);
86 
94  virtual void SetDimensions(const char* dimensions);
95 
100  bool ComputeArraySelection();
101 
103 
110  vtkGetObjectMacro(AllDimensions, vtkStringArray);
112 
114 
123  vtkGetMacro(ReplaceFillValueWithNan, vtkTypeBool);
124  vtkSetMacro(ReplaceFillValueWithNan, vtkTypeBool);
125  vtkBooleanMacro(ReplaceFillValueWithNan, vtkTypeBool);
127 
129 
134  vtkGetStringMacro(TimeUnits);
135  vtkGetStringMacro(Calendar);
137 
141  std::string QueryArrayUnits(const char* ArrayName);
142 
143 protected:
144  vtkNetCDFReader();
145  ~vtkNetCDFReader() override;
146 
147  char* FileName;
150 
155 
157 
159 
164 
166 
171 
173 
174  int WholeExtent[6];
175 
176  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
177  vtkInformationVector* outputVector) override;
178 
179  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
180  vtkInformationVector* outputVector) override;
181 
182  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
183  vtkInformationVector* outputVector) override;
184 
188  static void SelectionModifiedCallback(
189  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
190 
195  vtkStdString DescribeDimensions(int ncFD, const int* dimIds, int numDims);
196 
200  virtual int ReadMetaData(int ncFD);
201 
205  virtual int FillVariableDimensions(int ncFD);
206 
214  virtual int IsTimeDimension(int ncFD, int dimId);
215 
223  virtual vtkSmartPointer<vtkDoubleArray> GetTimeValues(int ncFD, int dimId);
224 
231  virtual bool DimensionsAreForPointData(vtkIntArray* vtkNotUsed(dimensions)) { return true; }
232 
239  virtual void GetUpdateExtentForOutput(vtkDataSet* output, int extent[6]);
240 
245  virtual int LoadVariable(int ncFD, const char* varName, double time, vtkDataSet* output);
246 
248 
249 private:
250  vtkNetCDFReader(const vtkNetCDFReader&) = delete;
251  void operator=(const vtkNetCDFReader&) = delete;
252 
253  int UpdateExtent[6];
254  char* TimeUnits;
255  char* Calendar;
256  vtkNetCDFReaderPrivate* Private;
257 };
258 
259 VTK_ABI_NAMESPACE_END
260 #endif // vtkNetCDFReader_h
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:27
vtkTypeBool ReplaceFillValueWithNan
abstract base class for most VTK objects
Definition: vtkObject.h:52
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
static vtkDataObjectAlgorithm * New()
record modification and/or execution time
Definition: vtkTimeStamp.h:24
a vtkAbstractArray subclass for strings
vtkTimeStamp FileNameMTime
A superclass for reading netCDF files.
vtkNetCDFAccessor * Accessor
dynamic, self-adjusting array of double
int vtkTypeBool
Definition: vtkABI.h:64
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:35
vtkSmartPointer< vtkStringArray > AllVariableArrayNames
a simple class to control print indentation
Definition: vtkIndent.h:28
Store on/off settings for data arrays, etc.
vtkSmartPointer< vtkIntArray > LoadingDimensions
The dimension ids of the arrays being loaded into the data.
std::string CurrentDimensions
#define VTK_FILEPATH
Superclass for algorithms that produce only data object as output.
vtkStringArray * VariableDimensions
Placeholder for structure returned from GetVariableDimensions().
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Store zero or more vtkInformation instances.
vtkTimeStamp MetaDataMTime
vtkStringArray * AllDimensions
Placeholder for structure returned from GetAllDimensions().
virtual bool DimensionsAreForPointData(vtkIntArray *dimensions)
Called internally to determine whether a variable with the given set of dimensions should be loaded a...
vtkSmartPointer< vtkDataArraySelection > VariableArraySelection
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.