GIS4WRF / gis4wrf

QGIS toolkit 🧰 for pre- and post-processing 🔨, visualizing 🔍, and running simulations 💻 in the Weather Research and Forecasting (WRF) model 🌀
https://gis4wrf.github.io
MIT License
159 stars 36 forks source link

export raster with unique id for each grid square #208

Closed AshBroadbent closed 2 years ago

AshBroadbent commented 3 years ago

Is there a straightforward way to convert the WRF domain to a shapefile or raster where each grid square has a unique ID?

dmey commented 3 years ago

If you want to save it to disk you can save we already generate a VRT layer when the domain is created (Named WRF-Domains (Grid)) under the Layers panel. I don't know what exactly you want to do but you could save that as GeoTIFF and patch in your preferred language. For example if you want to modify the values for the domain detailed in the tutorial using Python, you can save it to disk first and then process its values. E.g.

with rasterio.open('sample.tif') as src:
    arr = src.read(1) # this is just a numpy array

# Iterations on array index
for idx in arr:
    # do something...
    pass

# more processing, save...

image

dmey commented 2 years ago

Closing due to inactivity.