dshean / demcoreg

Utilities for DEM and point cloud co-registration
MIT License
110 stars 42 forks source link

beginners_doc - get_rgi.sh fails if libraries are not added to PATH #18

Open elischwat opened 4 years ago

elischwat commented 4 years ago

I followed the beginners_doc, but did not add paths to the three libraries (pygeotools, demcoreg, imview) to my PATH env var.

Upon trying to run dem_align.py, I was advised to run the get_rgi.sh script.

Missing rgi glacier data source. If already downloaded, specify correct datadir. If not, run `get_rgi.sh` to download

I ran the script and, after the large download completed, a "command not found" error then an OGR error was thrown.

Merging region shp for global shp
.../demcoreg/demcoreg/get_rgi.sh: line 80: ogr_merge.sh: command not found

Clipping to site: CONUS
POLYGON ((-125 49, -104 49, -104 32, -125 32, -125 49))
+proj=aea +lat_1=36 +lat_2=49 +lat_0=43 +lon_0=-115 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs
FAILURE:
Unable to open datasource `rgi60_merge.shp' with the following drivers.
  -> `PCIDSK'
  -> `netCDF'
  -> `JP2OpenJPEG'
  ......<long list of drivers>

The script is failing because it calls pygeotools' ogr_merge.sh script on line 80. If you have not added pygeotools to PATH, those files are not created, and we also get the red herring OGR error

Unable to open datasource `rgi60_merge.shp' with the following drivers.

because that file does not exist.

I resolved the issue by adding the paths to the three libraries to my PATH env var. Maybe the beginner docs could be updated to say that adding the libraries to your path is a requirement or perhaps get_rgi.sh can be modified as to not require that. No real bug here but I think walking through the beginner docs would be smoother if this was mentioned.

meghanasharp commented 4 years ago

Thanks for posting your solution to this issue. I am also following the beginner's document and receiving a very similar error when i run get_rgi.sh:

Unable to open datasource '*_rgi60_*shp' with the following drivers

I have added demcoreg, pygeotools and imview to my path, but this doesn't seem to solve the issue. The first three entries in my path (echo $PATH) are:

~/src/pygeotools/pygeotools:~/src/demcoreg/demcoreg:~/src/imview/imview

Here is a screenshot of the full error. Any help would be greatly appreciated!

Screen Shot 2020-04-23 at 10 12 36 AM
elischwat commented 4 years ago

It looks like you do not have wget installed on your mac (see the error on the 6th line of text in your screenshot). A file does not get downloaded and then you get a bunch of other errors afterwards that are misleading. You may be able to install wget in the terminal like this

brew install wget

If that doesn't work, just google for other ways to install wget (or ways to install brew if it's not installed, and then you can run the command above).

meghanasharp commented 4 years ago

Nice catch– that fixed it. Thanks for your help! :)

dshean commented 4 years ago

Thanks for reporting @elischwat. Sorry it's so convoluted and that those steps were not documented. Can you help to clean up that doc, add missing steps/notes, and submit a PR?

We should probably make the RGI download optional, and move most of the download steps to a separate wrapper, as mentioned in #17

Much of this stack was developed for specific projects over the years in my own environment, often with the "I just need to get the job done" requirement. So it's good to have fresh perspective from new users, and to be reminded of all of the hurdles to get up and running. As always, I appreciate any help to simplify, fix, and/or better document setup and tools.

dshean commented 4 years ago

Also, @meghansharp, wget is available via conda-forge these days. Follow instructions to add conda-forge channel, then: conda install wget

dshean commented 4 years ago

We should probably make the RGI download optional, and move most of the download steps to a separate wrapper, as mentioned in #17

FYI, I disabled RGI masking by default with https://github.com/dshean/demcoreg/commit/bd48b4f36354d7b40966ba0ec89c906ac7ecdd3a. Should work, but I did not test, can one of you pull latest master and rerun your test case(s)?