UMEP icon indicating copy to clipboard operation
UMEP copied to clipboard

SOLWEIG coordinates

Open brdumoul opened this issue 1 year ago • 21 comments

I'm trying to run SOLWEIG, my files are in the Geographical coordinate system: BD72. However when I look at the RunInfoSOLWEIG_2024_223_0000.txt file that I got, I see this.

Image

Where he recognizes the BD72, but the latitude and longitude are switched. Resulting in a sunrise and sunset at the wrong times leading to wrong Tmrt's in my output.

I work in Qgis version 3.40 where the coordinates in BD72 are represented as: 137196, 191038. When i put my coordinates in WGS:4326 this becomes: 51.02589°, 4.18671° At an older version of Qgis these was the same for BD72: 137196, 191038. But when put in WGS:4326 this is 4.18671°, 51.02589°

Does anyone know how to fix this? Thanks in advance!

brdumoul avatar Apr 25 '25 13:04 brdumoul

Hm, we have not changed anything from our side (or have we @nilswallenberg ?), so it must be something on the QGIS-side. As a quick-fix, try reproject into a common CRS that we know is working, e.g. UTM.

biglimp avatar Apr 25 '25 13:04 biglimp

No, we have not changed anything. Older versions of QGIS used gdal 2.x, that had swapped lat and lon, but this shouldn't be the case here. What versions of Python and GDAL do you have?

nilswallenberg avatar Apr 25 '25 14:04 nilswallenberg

I am using Python 3.9.18, qgis: QGIS 3.40.2-Bratislava 'Bratislava' (exported) but I'm unable to find the version of GDAL. I will try the suggested quick-fix tomorrow.

brdumoul avatar Apr 25 '25 15:04 brdumoul

I now reproject to EPSG:32631. Which leads to the correct lon and lat. But all SOLWEIG outputs seem to be night. the added picture is from 15:00, but all output times look identical.

Image

Image

brdumoul avatar May 01 '25 19:05 brdumoul

You need to make sure to update your Python which should be 3.12. Your gdal version is found in the about section.

biglimp avatar May 02 '25 06:05 biglimp

I now used python 3.12.3 and the gdal version is: GDAL 3.7.1, released 2023/07/06 Running this (with UTM coördinates) still only gives night values which all look the same as in my precious message.

Image

brdumoul avatar May 05 '25 10:05 brdumoul

Could you attach your metdata please.

biglimp avatar May 05 '25 10:05 biglimp

This is the metdata I am using. In UTM and SWEREF I only recieved files ending on N. But in Belgian Lambert 72( EPSG:31370) I do recieve files ending on D, but for the daytimes of Africa, because these lat and lon are swapped.

metdata.txt

brdumoul avatar May 05 '25 10:05 brdumoul

This is strange... Add a POI somewhere so that we can see the actual sun position at every timestep. Also, did you run the SOLWEIG tutorial with Gothenburg data and get correct result?

biglimp avatar May 05 '25 10:05 biglimp

I've added a POI in the center. POI1.txt file is attached down below.

I did run the SOLWEIG tutorial with Gothenburg data and that gave the correct result.

POI_1.txt

brdumoul avatar May 06 '25 00:05 brdumoul

Very strange. sun positions become nan-values. Must have to do with something concerning the CRS of the DSM since metdata, UTC etc. looks good. Can you try with another CRS?

biglimp avatar May 06 '25 09:05 biglimp

What CRS would you recommend for data in Belgium, or that should work in general?

brdumoul avatar May 06 '25 09:05 brdumoul

I am not sure as I have never seen this nan-values before. It must be related to your original CRS as UTM usually works fine. Maybe you have a geographical coordinate system that does not work well with transformation to UTM. The strange thing is that you seem to get correct coordinates in the RunInfo file when using UTM...

biglimp avatar May 06 '25 09:05 biglimp

This is the POI when left in Lambert 72. But then the lat and lon are swapped in the RunInfo file.

POI_LB.txt

Image

brdumoul avatar May 06 '25 09:05 brdumoul

What proj-version do you have? Go to About in QGIS and find out. Maybe you have an old version.

Here are my settings using a very recent QGIS version (3.42)

Image

biglimp avatar May 06 '25 10:05 biglimp

In the Qgis I use on the supercomputer i have this (which I use only using python, no GUI).

Image

On my local computer it's this:

Image

brdumoul avatar May 06 '25 10:05 brdumoul

And you get the same results in both environments?

biglimp avatar May 06 '25 10:05 biglimp

No, on my local pc I have just succeeded in receiving correct T_mrt for a the small grid (600x600m) with using the GUI (in Lambert 72). But when doing this on the supercomputer it swaps the lat and lon resulting in wrong D and N times. But my goal is to automate it further in python for bigger grids.

In the meantime I am trying to make this cut fully on the supercomputer. Before i had worked with the files on my local Qgis, so maybe something went wrong because these had different versions. (As in I merged/clipped files on my local Qgis, and then tried to process them om the supercomputer Qgis)

brdumoul avatar May 06 '25 10:05 brdumoul

Aha. Then the issue probably lies in that you have multiple installations of gdal etc on you HPC. You need to make sure that the correct version is used. I know that there could be system as well as user installed python versions etc. Personally, I have no idea how to fix this. Please report back when you find a solution. It might be good for other users to see this also.

biglimp avatar May 06 '25 10:05 biglimp

I have now reran it fully on the HPC, so no cross versions of Qgis were used. But the lat and lon are still swapped. So maybe it is something in that specific version ofQgis/Gdal?

brdumoul avatar May 06 '25 14:05 brdumoul

Your swapped lat/lon indicated an old version of gdal. My guess is that you have two conflicting versions on your HPC.

biglimp avatar May 06 '25 14:05 biglimp

Is this issue solved? Can I close?

biglimp avatar Nov 18 '25 12:11 biglimp

Yes and no. @brdumoul and I were able to do our simulations using a UTM crs, but the issue with the Lambert 72 crs remains. I believe the issue is not caused by conflicting versions of gdal on the HPC. (This was also an issue but has now been resolved).

I plan (when I find the time) to make a minimal reproducible error to see if the issue is caused by this crs.

Maybe you can close this one and I can open a new one once I have the MRE?

kobebryant432 avatar Nov 18 '25 15:11 kobebryant432

Ok, I close. Interested to see the performance of the model on a HPC. When/if you have a publication or report, please share. Good luck with your work!

biglimp avatar Nov 18 '25 15:11 biglimp