VTK  9.0.2
vtkNetCDFReader.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 /*=========================================================================
3 
4  Program: Visualization Toolkit
5  Module: vtkNetCDFReader.h
6 
7  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
8  All rights reserved.
9  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10 
11  This software is distributed WITHOUT ANY WARRANTY; without even
12  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13  PURPOSE. See the above copyright notice for more information.
14 
15 =========================================================================*/
16 
17 /*-------------------------------------------------------------------------
18  Copyright 2008 Sandia Corporation.
19  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
20  the U.S. Government retains certain rights in this software.
21 -------------------------------------------------------------------------*/
22 
34 #ifndef vtkNetCDFReader_h
35 #define vtkNetCDFReader_h
36 
37 #include "vtkDataObjectAlgorithm.h"
38 #include "vtkIONetCDFModule.h" // For export macro
39 
40 #include "vtkSmartPointer.h" // For ivars
41 #include <string> //For std::string
42 
44 class vtkDataSet;
45 class vtkDoubleArray;
46 class vtkIntArray;
47 class vtkStdString;
48 class vtkStringArray;
49 class vtkNetCDFReaderPrivate;
50 
51 class VTKIONETCDF_EXPORT vtkNetCDFReader : public vtkDataObjectAlgorithm
52 {
53 public:
55  static vtkNetCDFReader* New();
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
58  virtual void SetFileName(const char* filename);
59  vtkGetStringMacro(FileName);
60 
66 
67  // // Description:
68  // // Get the data array selection tables used to configure which variables to
69  // // load.
70  // vtkGetObjectMacro(VariableArraySelection, vtkDataArraySelection);
71 
73 
77  virtual const char* GetVariableArrayName(int idx);
78  virtual int GetVariableArrayStatus(const char* name);
79  virtual void SetVariableArrayStatus(const char* name, int status);
81 
88 
90 
96  vtkGetObjectMacro(VariableDimensions, vtkStringArray);
98 
106  virtual void SetDimensions(const char* dimensions);
107 
113 
115 
122  vtkGetObjectMacro(AllDimensions, vtkStringArray);
124 
126 
135  vtkGetMacro(ReplaceFillValueWithNan, vtkTypeBool);
136  vtkSetMacro(ReplaceFillValueWithNan, vtkTypeBool);
137  vtkBooleanMacro(ReplaceFillValueWithNan, vtkTypeBool);
139 
141 
146  vtkGetStringMacro(TimeUnits);
147  vtkGetStringMacro(Calendar);
149 
153  std::string QueryArrayUnits(const char* ArrayName);
154 
155 protected:
157  ~vtkNetCDFReader() override;
158 
159  char* FileName;
162 
167 
169 
171 
176 
178 
183 
185 
186  int WholeExtent[6];
187 
189  vtkInformationVector* outputVector) override;
190 
192  vtkInformationVector* outputVector) override;
193 
194  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
195  vtkInformationVector* outputVector) override;
196 
201  vtkObject* caller, unsigned long eid, void* clientdata, void* calldata);
202 
207  vtkStdString DescribeDimensions(int ncFD, const int* dimIds, int numDims);
208 
212  virtual int ReadMetaData(int ncFD);
213 
217  virtual int FillVariableDimensions(int ncFD);
218 
226  virtual int IsTimeDimension(int ncFD, int dimId);
227 
235  virtual vtkSmartPointer<vtkDoubleArray> GetTimeValues(int ncFD, int dimId);
236 
243  virtual bool DimensionsAreForPointData(vtkIntArray* vtkNotUsed(dimensions)) { return true; }
244 
251  virtual void GetUpdateExtentForOutput(vtkDataSet* output, int extent[6]);
252 
257  virtual int LoadVariable(int ncFD, const char* varName, double time, vtkDataSet* output);
258 
259 private:
260  vtkNetCDFReader(const vtkNetCDFReader&) = delete;
261  void operator=(const vtkNetCDFReader&) = delete;
262 
263  int UpdateExtent[6];
264  char* TimeUnits;
265  char* Calendar;
266  vtkNetCDFReaderPrivate* Private;
267 };
268 
269 #endif // vtkNetCDFReader_h
Store on/off settings for data arrays for a vtkSource.
Superclass for algorithms that produce only data object as output.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:40
A superclass for reading netCDF files.
virtual void SetVariableArrayStatus(const char *name, int status)
static void SelectionModifiedCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
Callback registered with the VariableArraySelection.
vtkTypeBool ReplaceFillValueWithNan
int UpdateMetaData()
Update the meta data from the current file.
virtual int LoadVariable(int ncFD, const char *varName, double time, vtkDataSet *output)
Load the variable at the given time into the given data set.
std::string QueryArrayUnits(const char *ArrayName)
Get units attached to a particular array in the netcdf file.
vtkSmartPointer< vtkDataArraySelection > VariableArraySelection
int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
bool ComputeArraySelection()
Enables arrays in VariableArraySelection depending on Dimensions.
virtual void GetUpdateExtentForOutput(vtkDataSet *output, int extent[6])
Retrieves the update extent for the output object.
virtual int GetVariableArrayStatus(const char *name)
virtual vtkSmartPointer< vtkDoubleArray > GetTimeValues(int ncFD, int dimId)
Given a dimension already determined to be a time dimension (via a call to IsTimeDimension) returns a...
vtkSmartPointer< vtkStringArray > AllVariableArrayNames
vtkTimeStamp MetaDataMTime
vtkStdString DescribeDimensions(int ncFD, const int *dimIds, int numDims)
Convenience function for getting a string that describes a set of dimensions.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetFileName(const char *filename)
vtkTimeStamp FileNameMTime
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
virtual bool DimensionsAreForPointData(vtkIntArray *vtkNotUsed(dimensions))
Called internally to determine whether a variable with the given set of dimensions should be loaded a...
virtual int FillVariableDimensions(int ncFD)
Fills the VariableDimensions array.
virtual vtkStringArray * GetAllVariableArrayNames()
Convenience method to get a list of variable arrays.
vtkSmartPointer< vtkIntArray > LoadingDimensions
The dimension ids of the arrays being loaded into the data.
virtual int GetNumberOfVariableArrays()
Variable array selection.
vtkStringArray * VariableDimensions
Placeholder for structure returned from GetVariableDimensions().
virtual int IsTimeDimension(int ncFD, int dimId)
Determines whether the given variable is a time dimension.
virtual int ReadMetaData(int ncFD)
Reads meta data and populates ivars.
virtual const char * GetVariableArrayName(int idx)
~vtkNetCDFReader() override
static vtkNetCDFReader * New()
virtual void SetDimensions(const char *dimensions)
Loads the grid with the given dimensions.
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
vtkStringArray * AllDimensions
Placeholder for structure returned from GetAllDimensions().
std::string CurrentDimensions
abstract base class for most VTK objects
Definition: vtkObject.h:63
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:35
a vtkAbstractArray subclass for strings
record modification and/or execution time
Definition: vtkTimeStamp.h:33
@ time
Definition: vtkX3D.h:503
@ extent
Definition: vtkX3D.h:351
@ name
Definition: vtkX3D.h:225
@ string
Definition: vtkX3D.h:496
int vtkTypeBool
Definition: vtkABI.h:69