[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #GJB-904115]: (No Subject)



Hello,

NetCDF stores data provided to it; if the data provider writes noise data to 
the netCDF file, then it will contain noise.  Otherwise, you will need to 
compute the noise (as per your needs) on the underlying data.  NetCDF doesn't 
provide any 'color branching' functionality; you might contact Kitware support 
for help with vtk-related questions.

Thanks!

-Ward

> question how do you do the color branching does netcdf use noise data here
> is code i already have for c++ in opengl
> 
> float scalingFactor = 1.0f / 2.122f;
> 
> glEnable(GL_QUADS);
> glShadeModel(GL_SMOOTH);
> 
> vtkSmartPointer<vtkPolyDataMapper> mapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> 
> vtkSmartPointer<vtkDataSet> data =
> vtkDataSet::SafeDownCast(reader->GetOutput());
> 
> glPushMatrix();
> glRotatef(-90.0f, -10.0f, -10.0f, -43.0f);
> 
> double minNoiseValue = std::numeric_limits<double>::max();
> double maxNoiseValue = std::numeric_limits<double>::lowest();
> 
> for (vtkIdType i = 0; i < data->GetNumberOfCells(); i++) {
> vtkCell* cell = data->GetCell(i);
> vtkPoints* points = cell->GetPoints();
> 
> if (cell->GetNumberOfPoints() == 4) {
> 
> for (int j = 0; j < cell->GetNumberOfPoints(); j++) {
> double noise[3];
> points->GetPoint(j, noise);
> double noiseValue = noise[0];
> 
> minNoiseValue = std::min(minNoiseValue, noiseValue);
> maxNoiseValue = std::max(maxNoiseValue, noiseValue);
> }
> }
> }
> 
> vtkSmartPointer<vtkColorTransferFunction> colorTransferFunction =
> vtkSmartPointer<vtkColorTransferFunction>::New();
> 
> colorTransferFunction->AddRGBPoint(minNoiseValue, 0.0, 0.0, 1.0);
> // Blue
> colorTransferFunction->AddRGBPoint(minNoiseValue + (maxNoiseValue -
> minNoiseValue) * 0.25, 1.0, 1.0, 0.0);   // Yellow
> colorTransferFunction->AddRGBPoint((minNoiseValue + maxNoiseValue)
> / 2.0, 1.0, 0.0, 0.0);   // Red
> colorTransferFunction->AddRGBPoint(minNoiseValue + (maxNoiseValue -
> minNoiseValue) * 0.75, 1.0, 1.0, 0.0);   // Yellow
> colorTransferFunction->AddRGBPoint(maxNoiseValue, 0.0, 0.0, 1.0);
> // Blue
> 
> for (vtkIdType i = 0; i < data->GetNumberOfCells(); i++) {
> vtkCell* cell = data->GetCell(i);
> vtkPoints* points = cell->GetPoints();
> 
> if (cell->GetNumberOfPoints() == 4) {
> glBegin(GL_QUADS);
> 
> for (int j = 0; j < cell->GetNumberOfPoints(); j++) {
> double noise[3];
> points->GetPoint(j, noise);
> 
> double noiseValue = noise[0];
> 
> double color[3];
> colorTransferFunction->GetColor(noiseValue, color);
> 
> glColor4f(color[0], color[1], color[2], 0.5);
> 
> float lon = points->GetPoint(j)[0];
> float lat = points->GetPoint(j)[1];
> float altitude = points->GetPoint(j)[2];
> 
> 
> glVertex3f(lon * scalingFactor, lat * scalingFactor,
> altitude * scalingFactor);
> }
> glEnd();
> }
> }
> 
> glPopMatrix();
> here is what i get
> [image: Screenshot 2023-07-10 135625.png]
> this is what i am tying to achieve
> [image: Screenshot 2023-07-10 135707.png]
> in the red circle there is isn't a branch off area for the temperature data
> but in panoply there is how do i achieve the branch off area for my code?
> 
> 


Ticket Details
===================
Ticket ID: GJB-904115
Department: Support netCDF
Priority: Normal
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.