How to convert a netCDF array to a GeoTIFF file?
I have read a NetCDF file using the netCDF4 library and then read one of its datasets (“Evapotranspiration”) into a variable (variable contains array) using the following code. Subsequently now I am trying to convert this array into a GeoTIFF file using rasterio.
How to convert an array to a GeoTIFF in rasterio?
Subsequently now I am trying to convert this array into a GeoTIFF file using rasterio. However, the resulting GeoTIFF is appearing to be rotated by 90 Degrees when I am opening it in QGIS. Following is my code: Further I also tried GDAL to implement the same but no success as of now.
When to normalize data to a 0-1 range?
One thing to keep in mind is that max – min could equal zero. In this case, you would not want to perform that division. The case where this would happen is when all values in the list you’re trying to normalize are the same. To normalize such a list, each item would be 1 / length.
How to create a GeoTIFF from a CRS file?
If your CRS is not discovered, you should be able to add it like so: Then, you should be able to create a geotiff from the Evapotranspiration like so: If this does not produce the correct results, I would be interested in learning more about your input file data.
Can a rasterio read a netCDF file?
For anyone arriving here from Google, it does appear that rasterio does read netCDF files such that the data is transposed and rotated from the typical reading of GeoTiffs. Thanks for contributing an answer to Geographic Information Systems Stack Exchange! Please be sure to answer the question.
How to open a netCDF file with xarray?
To open a NetCDF file we can use xarray.open_dataset (). Similarly to the GeoTIFF example above, this function can also be used to open large NetCDF files as Dask arrays by providing a chunks parameter (e.g. chunks= {‘x’: 1000, ‘y’: 1000} ).