problem creating PCraster location map required for reporting time-series of the various model fluxe

129 views
Skip to first unread message

Sai Krishna

unread,
Sep 22, 2024, 9:30:14 AM9/22/24
to SPHY-model-user
I am preparing inputs for SPHY v2.2.1 model as per model building instructions.
I am facing problem in preparing PCRaster format(.map) location file.  (https://sphy.readthedocs.io/en/latest/building.html#locations)
This locations.map file is said to be required for reporting time-series model fluxes and also for creating catchment.map file.
The sphy documentation provided didn't specifically mention how to convert locations.shp file to locations.map format file. 
Hence, I had searched for other resources and found a tutorial (https://courses.gisopencourseware.org/mod/book/view.php?id=828&chapterid=2095) mentioning to use "Column File to PCRaster Map processing tool" on QGIS.
Accordingly, I tried the steps as seen in the figure below, but facing with persistent errors and unable to resolve the same.
Error_locationmap.png

I am looking for a suitable process to create locations.map format file using locations.shp file or locations.csv file.



WilcoTerink

unread,
Sep 22, 2024, 2:36:52 PM9/22/24
to SPHY-model-user
Hi,

I think your problem is related to the fact that your locations.map is not a raster? Have you converted the locations shapefile with stations numbered 1, 2, etc. to a raster map according to these instructions: https://sphy.readthedocs.io/en/latest/building.html#other-static-input-maps

?

Sai Krishna

unread,
Sep 23, 2024, 1:35:05 PM9/23/24
to SPHY-model-user
I  have tried multiple ways to convert location shape file or csv formatted locations files, to raster format (.map) file.
As per the instruction in sphy documentation (https://sphy.readthedocs.io/en/latest/building.html#locations), I tried various ways to create .map file from station location shape file as mentioned in the question of this thread.
I have further tried using rasterize tool to convert shapefile to .map or also .tif  file (https://gis.stackexchange.com/questions/243513/convert-points-shp-file-to-raster-tif-in-qgis), but getting stuck with persistent error.
Error_Rasterize_stations_shpfile_mapfile.png
The above error reads: "Wrong value for -ts parameter"

Kindly provide suitable solution to convert the station shapefile into raster layer. 

WilcoTerink

unread,
Sep 25, 2024, 3:30:03 AM9/25/24
to SPHY-model-user

It looks like you’re only giving it a horizontal resolution of 250. A similar value should be set for the vertical resolution, which is now zero…
Message has been deleted

Sai Krishna

unread,
Sep 29, 2024, 1:24:10 AM9/29/24
to SPHY-model-user
Thanks for reply @Wilco.
The problem still persists even after setting vertical resolution as 250 along with horizontal resolution as 250.
Kindly help me debug the issue.
PCRasterScaleError1_Rasterize_station_point layer_to_rasterlayer_horizontal&verticalresolution250m.png

WilcoTerink

unread,
Sep 29, 2024, 2:28:49 PM9/29/24
to SPHY-model-user
It can sometimes be a bit complicated to calculate a PCRaster map directly from inside QGIS. Therefore, it is recommended to create a GTIFF first and then translate that into a PCRaster as per the instructions on my website.

Sai Krishna

unread,
Sep 29, 2024, 10:57:24 PM9/29/24
to SPHY-model-user
Thank you @Wilco
Finally converted station point vector layer in two steps: 1) Rasterize to geotiff, 2) translate from geotiff raster format to PCRaster format 
It is noted that the raster size units in Rasterize needs to be "Georeferenced units", unlike  "Pixels" used earlier.
 
Station_location_ptlayer_to_PCraster_250m.png

Sai Krishna

unread,
Oct 2, 2024, 12:18:17 AM10/2/24
to SPHY-model-user
A correction to above step on converting point layer to PCraster 
Need to set datatype as Nominal datatype, as required by the catchment map function (Building a model — SPHY 2.2.1 documentation)
1) Rasterize to geotiff, 
2) Use "Convert to PCRaster format" QGIS tool, to convert geotiff raster format to PCRaster format with output datatype as Nominal 
Rasterize_stationlocationsPtlayer_to_geotiff250m_to_PCRasterNominalDtype.png
Reply all
Reply to author
Forward
0 new messages