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
166 stars 36 forks source link

Convert Multiband Raster to WPS binary #145

Open taoansf opened 5 years ago

taoansf commented 5 years ago

Hello,

I'm trying do convert a multiband raster to WPS binary by GIS4WRF process tool image

However the resulting output is a single band binary file.

I attached my input and and output data for your checking. green-mask-final-small.zip greenfrac_fpar_modis-07-2019-wps.zip

Any help will be very appreciated.

With best regards,

Taoan

dmey commented 5 years ago

I do not quite understand why you want to convert a multi band to WPS binary but in any case this feature is not supported. You need to convert to single band first.

taoansf commented 5 years ago

My idea is to update geogrid database to increase coast line resolution in my WRF simulations. I got good improvements with Landuse data, which is single band. However, Albedo, Greenfraction and others multiband data I can't do because it is not working with GIS4WRF conversion tool.

If you know another way to do this, please share it with me.

Thank you for your attention.

Taoan

dmey commented 5 years ago

We do not support that feature at the moment. @letmaik I was going to add this as a feature request under the future milestone -- I am not sure we should aim to add this at the next release due to time...

letmaik commented 5 years ago

That's right, this is not supported currently and there is no work-around for this either. We should really print an error message in that case instead of simply converting the first band.

@dmey future sounds fine, it's not a simple fix but requires some work and I don't think we have the resources currently to do this in the near future.

@taoansf Contributions are always welcome. The code is here: https://github.com/GIS4WRF/gis4wrf/blob/master/gis4wrf/core/writers/wps_binary.py.

taoansf commented 5 years ago

Thanks all I will study wps_binary.py to understand better the process.

I also found this explanation about wps format that give some insights http://www.met.wur.nl/Summerinthecity/posts/2014/03/wrfgisinput/

If wps format is similar to ENVI image format, so I will look for some solution by this way using GDAL.

However, I have another question related with "wordsize" parameter on wps index file. I got this error when I try to convert a geotiff float32 to wps and open the output with GIS4WRF. image

Is there some trick for conversion of geotiff and get a "wordsize=2"? because I only get wordsize=4 on my output.

These are my test files. SOILTEMP.zip

letmaik commented 5 years ago

Currently wordsize is determined automatically with a heuristic with the goal of trying to represent the input as accurately as possible. Feel free to open a separate feature request about this as it should really be an option for the user to choose it manually if needed, typically to reduce data volume.

The error you got is correct and a limitation of GDAL which doesn't support this high bit depth natively. Again, feel free to open a feature request for that. The way to do it would be to preprocess the WPS data (downsampling) before handing it to GDAL.

sampr7 commented 4 years ago

My idea is to update geogrid database to increase coast line resolution in my WRF simulations. I got good improvements with Landuse data, which is single band. However, Albedo, Greenfraction and others multiband data I can't do because it is not working with GIS4WRF conversion tool.

If you know another way to do this, please share it with me.

Thank you for your attention.

Taoan

Greetings Taoan, When I tried to alter the default landuse data in WRF using gis4wrf, it is throwing datum shift warning. Can I avoid this warning or should I do something else? First of all I loaded the landuse data by add wps binary layer and then exported it to geotiff format. Then I edited some grid boxes using Serval and then clicked on convert active layer to binary . Thank you

taoansf commented 4 years ago

Hello samp7,

I'm sorry for the late answer. My sugestion is to adopt the WGS84 datum epsg:4326 to avoid conflicts. This article can give you some orientations https://fabienmaussion.info/2018/01/06/wrf-projection/ I also recomend this plugin for raster edition https://github.com/SMByC/ThRasE

I hope this help you.

With best regards,

Taoan