Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrfout.nc cause lat/long exception in ninja::set_position() #383

Closed
Chrismarsh opened this issue Jul 31, 2020 · 2 comments
Closed

wrfout.nc cause lat/long exception in ninja::set_position() #383

Chrismarsh opened this issue Jul 31, 2020 · 2 comments

Comments

@Chrismarsh
Copy link
Contributor

When loading a wrfout.nc I get the error

Exception caught: Latitude greater than 90 degrees or less than -90 degrees in ninja::set_position().

I've traced the code and it seems to me that the lat and long values are swapped.

From gdb here

set_position(latitude, longitude);

lon = {double} 50.900377879743679
lat = {double} -115.23122284901007

I tried swapping lat/long just to see and it doesn't work

Run 0: Reading elevation file...
Run 0: Simulation time is 2017-Sep-01 00:00:00 MDT
Run 0: Generating mesh...
Run 0: Initializing flow...
Exception caught: Invalid cell reference in AsciiGrid<T>::get_cellIndex().
Exception caught: Invalid cell reference in AsciiGrid<T>::get_cellIndex().

This occurs with a wrfout.nc I've created myself. It also happens with a wrfout Natalie provided me, however I'm not totally sure of the DEM to be using with it. It does not happen with the 20170603T1800.nc and big_butte_small.tif files in the example data dir.

System details:

$ uname -a
Darwin lappy.local 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar  4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64`

$ clang --version
Apple clang version 11.0.0 (clang-1100.0.33.16)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

CMake
I have added these lines to the top of the CMakeLIsts.txt otherwise I have a problem with the code not detecting a C++11 compiler

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Invocation

cmake -DCMAKE_BUILD_TYPE=Debug -DNINJA_QTGUI=FALSE -DNINJAFOAM=FALSE -DNINJA_SCM_REVISION=1 -DOPENMP_SUPPORT=FALSE -G "CodeBlocks - Unix Makefiles" ~/windninja
@Chrismarsh
Copy link
Contributor Author

Chrismarsh commented Jul 31, 2020

I wonder if this could it be related to the GDAL3.0 change surrounding the transform function?
https://gdal.org/tutorials/osr_api_tut.html?highlight=transform#crs-and-axis-order
OSGeo/gdal#1546

$ gdal-config --version
3.1.2

ksshannon added a commit that referenced this issue Jul 31, 2020
RFC 73[0] introduces a better way to handle axis ordering in
projections, allowing for querying and setting the order in some cases.

This fixes one such case that was found in #383, and applies the same
fix to a few other spots in gdal_util.cpp.  FetchTimeZone() has an
instance that needs to be looked at.  #383 will be re-purposed to track
all of these.

Updates #383
@ksshannon
Copy link
Member

Closing this, see #384 for a more general purpose issue.

ksshannon added a commit that referenced this issue Aug 19, 2020
RFC 73[0] introduces a better way to handle axis ordering in
projections, allowing for querying and setting the order in some cases.

This fixes one such case that was found in #383, and applies the same
fix to a few other spots in gdal_util.cpp.  FetchTimeZone() has an
instance that needs to be looked at.  #383 will be re-purposed to track
all of these.

Updates #383
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants