NetCDFViewer

class geoanalytics.visualization.NetCDFViewer.NetCDFViewer(inputFile)[source]

Bases: object

About this algorithm

Description:

NetCDFViewer is a raster data visualization tool designed for rendering single-band raster layers from NetCDF (.nc) files. It leverages rasterio for data access and matplotlib for rendering. The class supports customizable colormaps and plot titles, making it suitable for visualizing meteorological, oceanographic, or climate data.

Parameters:
  • inputFile (str): Path to the input NetCDF (.nc) file.

Attributes:
  • inputFile (str) – The path to the NetCDF file to be visualized.

  • imageData (numpy.ndarray) – The raster data extracted from the NetCDF file.

Execution methods

Calling from a Python program

from geoanalytics.visualization import NetCDFViewer

viewer = NetCDFViewer("sample.nc")

viewer.run(cmap='plasma', title='NetCDF Raster Display')

Credits

This implementation was developed by Raashika and revised by M. Charan Teja under the guidance of Professor Rage Uday Kiran.

run(cmap='gray', title='NC Image')[source]

Reads and displays the first raster band from the NetCDF file.

Parameters:
  • cmap (str) – Colormap to use for visualization (default: ‘gray’).

  • title (str) – Plot title to display (default: ‘NC Image’).

Raises:

ValueError – If image data is not loaded properly.