Error in Running WRF_Hydro_Regridding_Spatial_Weights.py – "PROJ: lcc: Invalid latitude"

44 views
Skip to first unread message

Fatemeh Shirkhanloo

unread,
Jul 29, 2025, 11:58:18 PMJul 29
to wrf-hydro_users

Dear WRF-Hydro Team,

I hope you are well.

I am currently running the WRF_Hydro_Regridding_Spatial_Weights.py  script in HPC Cluster to create spatialweights.nc file for my domain, and I received the following error:

RuntimeError: PROJ: lcc: Invalid latitude

I would appreciate it if you could help me to solve it.

Best Regards,
Fatemeh

zed li

unread,
Sep 1, 2025, 9:23:46 AMSep 1
to wrf-hydro_users, Fatemeh Shirkhanloo

Dear Fatemeh,

I hope this message finds you well.

I came across your post regarding the error you encountered while running the WRF_Hydro_Regridding_Spatial_Weights.py script:


RuntimeError: PROJ: lcc: Invalid latitude

I am currently facing the same issue and was wondering if you have managed to resolve it. If so, I would greatly appreciate any insights or guidance you could offer to help me address this error.

Thank you in advance for your time and assistance. Looking forward to your response.

Best regards,
Zed Li

zed li

unread,
Sep 2, 2025, 5:08:45 AMSep 2
to wrf-hydro_users, Fatemeh Shirkhanloo
Hi Fatemeh,

I hope this message finds you well.
The cause of the problem appears to be that the version of the GDAL library is too high (greater than 3.*). In GDAL versions 3.0 and above, the convention for representing coordinates changed from (longitude, latitude) to (latitude, longitude), which leads to the "Invalid latitude" error.
Best Regards,
zed li
在2025年7月30日星期三 UTC+8 11:58:18<Fatemeh Shirkhanloo> 写道:

Kevin Sampson

unread,
Sep 2, 2025, 6:10:52 PMSep 2
to wrf-hyd...@ucar.edu, Fatemeh Shirkhanloo
Fatemeh,

Do you have the projection information for your domain? The error indicates an invalid latitude, which usually means the latitude is outside the bounds (-90, 90). Can you check your domain coordinate system information and report back?

Kevin

--
You received this message because you are subscribed to the Google Groups "wrf-hydro_users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wrf-hydro_use...@ucar.edu.
To view this discussion visit https://groups.google.com/a/ucar.edu/d/msgid/wrf-hydro_users/e7606f52-283d-4adf-a003-253ea97eab8dn%40ucar.edu.

Fatemeh Shirkhanloo

unread,
Sep 2, 2025, 6:24:04 PMSep 2
to zed li, wrf-hydro_users
Hi Zed, 


I hope you are well.

While running the WRF-Hydro ArcGIS regridding preprocessor script, I encountered the error "PROJ: lcc: Invalid latitude" when attempting to transform geographic coordinates using the Lambert Conformal Conic (LCC) projection. This was due to a change in axis order conventions introduced in GDAL 3.x and PROJ 6+, where EPSG:4326 (WGS84) now defaults to latitude–longitude order instead of the traditional GIS-friendly longitude–latitude. As a result, the script passed coordinates as (lon, lat), but PROJ interpreted the first value as latitude, leading to an out-of-range error. I resolved this by explicitly setting the axis mapping strategy to traditional GIS order using wgs84_proj.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)  after importing EPSG:4326 in the script. This ensured the coordinates were correctly interpreted and allowed the projection transformation to proceed without errors. 

It is how I fixed the problem. 

Best regards,
Fatemeh


Fatemeh Shirkhanloo

unread,
Sep 2, 2025, 6:26:24 PMSep 2
to Kevin Sampson, wrf-hyd...@ucar.edu
Hi Kevin,


I hope you are well.

As I explained to Zed, this is how I fixed the problem: 


While running the WRF-Hydro ArcGIS regridding preprocessor script, I encountered the error "PROJ: lcc: Invalid latitude" when attempting to transform geographic coordinates using the Lambert Conformal Conic (LCC) projection. This was due to a change in axis order conventions introduced in GDAL 3.x and PROJ 6+, where EPSG:4326 (WGS84) now defaults to latitude–longitude order instead of the traditional GIS-friendly longitude–latitude. As a result, the script passed coordinates as (lon, lat), but PROJ interpreted the first value as latitude, leading to an out-of-range error. I resolved this by explicitly setting the axis mapping strategy to traditional GIS order using wgs84_proj.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)  after importing EPSG:4326 in the script. This ensured the coordinates were correctly interpreted and allowed the projection transformation to proceed without errors. 

Best Regards, 
Fatemeh

Kevin Sampson

unread,
Sep 5, 2025, 6:00:32 PMSep 5
to Fatemeh Shirkhanloo, wrf-hyd...@ucar.edu
Fatemeh,

Thank you for the feedback and solution. I am familiar with this issue but had not encountered it in this script. I made the changes you proposed and will push it to the main WRF-Hydro GIS Pre-processing library after testing.

Cheers,

Kevin
Reply all
Reply to author
Forward
0 new messages