TransWikia.com

Using NetCDF file in PostgreSQL database?

Geographic Information Systems Asked by I. Jones on September 3, 2021

I have a NetCDF file which is 25 by 20 grids by latitude and longitude and contains hourly rainfall data at each grid. In total I have 780 hours worth of data. I was trying to use ArcGIS to create a raster, but I could only get one hour at a time. Is there a way to convert it to another file type or to a raster with all the hours so I can easily use it in my database?

One Answer

You may use ArcGIS to convert your netcdf file into geotiff files. You've stated that you are able to get one hour at a time. You'll need to just automate your approach using Arcpy (Python). ArcGIS already has Multidimension Tools Toolset to deal with NetCDF data. You can use Make NetCDF Raster Layer tool. There may be 2 approaches to do the task.

Approach-1

Use Make NetCDF Raster Layer tool such that

Input netCDF File = your nc file

Variable = prate (or whatever variable is there to depict precipitation)

X Dimension = lon

Y Dimension = lat

Output Raster Layer = Your defined output name

Band Dimension = time

Leave Dimension Values blank. It will generate a single raster layer with 780 bands (assuming you have a single nc file having 780 hours of data). You may export this raster layer into geotiff file or simply use it as it is.

Loop through each band of this output raster layer and extract each band. For this, you may look into this link.

You'll just have to name your output files to depict exact timestamp of each band. If you are familiar with python, it should be no issue.

Approach-2

You may access the above mentioned tool using arcpy from the start as follows

arcpy.MakeNetCDFRasterLayer_md(inputfilepath, "prate", "lon", "lat", "temporaryraster", "", dimension_value, "BY_VALUE")

dimension_value here is a list that is generated from netcdffile.getDimensionValue(dimension_type, dateband)

You may loop through each value of dimension_value and use it in above script line to make raster layer for each band from the start.

Answered by Badar Munir on September 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP