5 #ifndef WrappedPython_XArrayCFReader_XArrayCFReader_h 6 #define WrappedPython_XArrayCFReader_XArrayCFReader_h 16 "from paraview.util.vtkAlgorithm import *\n" 17 "from vtkmodules.util.xarray_support import vtkXArrayCFReader\n" 18 "from vtkmodules.vtkCommonExecutionModel import vtkStreamingDemandDrivenPipeline\n" 20 "@smproxy.reader(name=\"XArrayCFReader\", label=\"XArrayCF Reader\",\n" 21 " extensions=\"nc h5 zgroup grib\", file_description=\"XArray files\")\n" 22 "class XArrayCFReader(vtkXArrayCFReader):\n" 23 " '''Reads data from a file using the XArray readers and then connects\n" 24 " the XArray data to the vtkNetCDFCFREader (using zero-copy when\n" 25 " possible). At the moment, data is copied for coordinates (because\n" 26 " they are converted to double in the reader) and for certain data\n" 27 " that is subset either in XArray or in VTK. Lazy loading in XArray\n" 28 " is respected, that is data is accessed only when it is needed.\n" 29 " Time is passed to VTK either as an int64 for datetime64 or\n" 30 " timedelta64, or as a double (using cftime.toordinal) for cftime.\n" 32 " def __init__(self):\n" 33 " super().__init__()\n" 35 " @smproperty.stringvector(name=\"FileName\")\n" 36 " @smdomain.filelist()\n" 37 " @smhint.filechooser(extensions=\"nc,h5,zgroup,grib\", file_description=\"XArray files\")\n" 38 " def SetFileName(self, name):\n" 39 " \"\"\"Specify filename for the file to read.\"\"\"\n" 40 " if os.path.basename(name) == '.zgroup':\n" 41 " super().SetFileName(os.path.dirname(name))\n" 43 " super().SetFileName(name)\n" 46 " @smproperty.stringvector(name=\"DimensionInfo\", information_only=\"1\")\n" 47 " @smdomain.xml(\"\"\"<StringArrayHelper />\"\"\")\n" 48 " def GetAllDimensions(self):\n" 49 " # cannot use super(). see https://stackoverflow.com/questions/12047847/super-object-not-calling-getattr\n" 50 " all_dims = self._reader.GetAllDimensions()\n" 54 " @smproperty.stringvector(name=\"Dimensions\", number_of_elements=\"1\")\n" 56 " \"\"\"<StringListDomain name=\"array_list\">\n" 57 " <RequiredProperties>\n" 58 " <Property name=\"DimensionInfo\" function=\"ArrayList\"/>\n" 59 " </RequiredProperties>\n" 60 " </StringListDomain>\n" 61 " <Documentation>Load the grid with the given dimensions. Any arrays that\n" 62 " conform to these dimensions will be loaded.</Documentation>\n" 64 " def SetDimensions(self, dims):\n" 65 " # cannot use super(). see https://stackoverflow.com/questions/12047847/super-object-not-calling-getattr\n" 66 " if dims != 'None':\n" 67 " self._reader.SetDimensions(dims)\n" 71 " @smproperty.intvector(name=\"SphericalCoordinates\", number_of_elements=\"1\",\n" 72 " default_values=\"1\")\n" 74 " \"\"\"<BooleanDomain name=\"bool\" />\n" 75 " <Documentation>If on, then data with latitude/longitude dimensions will\n" 76 " be read in as curvilinear data shaped like spherical coordinates. If\n" 77 " false, then the data will always be read in Cartesian\n" 78 " coordinates.</Documentation>\n" 80 " def SetSphericalCoordinates(self, spherical):\n" 81 " # cannot use super(). see https://stackoverflow.com/questions/12047847/super-object-not-calling-getattr\n" 82 " self._reader.SetSphericalCoordinates(spherical)\n" 85 " @smproperty.doublevector(name=\"VerticalScale\", number_of_elements=\"1\",\n" 86 " default_values=\"1\")\n" 88 " \"\"\"<DoubleRangeDomain name=\"range\" />\n" 89 " <Documentation>The scale of the vertical component of spherical\n" 90 " coordinates. It is common to write the vertical component with respect\n" 91 " to something other than the center of the sphere (for example, the\n" 92 " surface). In this case, it might be necessary to scale and/or bias the\n" 93 " vertical height. The height will become height*scale + bias. Keep in\n" 94 " mind that if the positive attribute of the vertical dimension is down,\n" 95 " then the height is negated. The scaling will be adjusted if it results\n" 96 " in invalid (negative) vertical values.</Documentation>\n" 98 " def SetVerticalScale(self, scale):\n" 99 " # cannot use super(). see https://stackoverflow.com/questions/12047847/super-object-not-calling-getattr\n" 100 " self._reader.SetVerticalScale(scale)\n" 104 " @smproperty.doublevector(name=\"VerticalBias\", number_of_elements=\"1\",\n" 105 " default_values=\"0\")\n" 106 " @smdomain.xml(\\\n" 107 " \"\"\"<DoubleRangeDomain name=\"range\" />\n" 108 " <Documentation>The bias of the vertical component of spherical\n" 109 " coordinates. It is common to write the vertical component with respect\n" 110 " to something other than the center of the sphere (for example, the\n" 111 " surface). In this case, it might be necessary to scale and/or bias the\n" 112 " vertical height. The height will become height*scale + bias. Keep in\n" 113 " mind that if the positive attribute of the vertical dimension is down,\n" 114 " then the height is negated. The scaling will be adjusted if it results\n" 115 " in invalid (negative) vertical values.</Documentation>\n" 117 " def SetVerticalBias(self, bias):\n" 118 " # cannot use super(). see https://stackoverflow.com/questions/12047847/super-object-not-calling-getattr\n" 119 " self._reader.SetVerticalBias(bias)\n" 122 " @smproperty.intvector(name=\"ReplaceFillValueWithNan\", number_of_elements=\"1\",\n" 123 " default_values=\"0\")\n" 124 " @smdomain.xml(\\\n" 125 " \"\"\"<BooleanDomain name=\"bool\" />\n" 126 " <Documentation>If on, any float or double variable read that has a\n" 127 " _FillValue attribute will have that fill value replaced with a\n" 128 " not-a-number (NaN) value. The advantage of setting these to NaN values\n" 129 " is that, if implemented properly by the system and careful math\n" 130 " operations are used, they can implicitly be ignored by calculations\n" 131 " like finding the range of the values. That said, this option should be\n" 132 " used with caution as VTK does not fully support NaN values and\n" 133 " therefore odd calculations may occur.</Documentation>\n" 135 " def SetReplaceFillValueWithNan(self, replace):\n" 136 " # cannot use super(). see https://stackoverflow.com/questions/12047847/super-object-not-calling-getattr\n" 137 " self._reader.SetReplaceFillValueWithNan(replace)\n" 140 " @smproperty.intvector(name=\"OutputType\", number_of_elements=\"1\",\n" 141 " default_values=\"-1\")\n" 142 " @smdomain.xml(\\\n" 143 " \"\"\"<EnumerationDomain name=\"enum\">\n" 144 " <Entry text=\"Automatic\"\n" 146 " <Entry text=\"Image\"\n" 148 " <Entry text=\"Rectilinear\"\n" 150 " <Entry text=\"Structured\"\n" 152 " <Entry text=\"Unstructured\"\n" 154 " </EnumerationDomain>\n" 155 " <Documentation>Specifies the type of data that the reader creates. If\n" 156 " Automatic, the reader will use the most appropriate grid type for the\n" 157 " data read. Note that not all grid types support all data. A warning is\n" 158 " issued if a mismatch occurs.</Documentation>\n" 160 " def SetOutputType(self, output_type):\n" 161 " # cannot use super(). see https://stackoverflow.com/questions/12047847/super-object-not-calling-getattr\n" 162 " self._reader.SetOutputType(output_type)\n" 166 " @smproperty.doublevector(name=\"TimestepValues\", information_only=\"1\", si_class=\"vtkSITimeStepsProperty\")\n" 167 " def GetTimestepValues(self):\n" 168 " information = self.GetOutputInformation(0)\n" 169 " if information.Has(vtkStreamingDemandDrivenPipeline.TIME_STEPS()):\n" 170 " times = information.Get(vtkStreamingDemandDrivenPipeline.TIME_STEPS())\n" 182 char* res =
new char[ len + 1];
185 assert(offset == len);
char * module_XArrayCFReader_XArrayCFReader_source()
static const char *const module_XArrayCFReader_XArrayCFReader_string0