Comments (4)
I just tested it, and everything seems to work fine. Your CWD
and --wd
in the output are different directories. They are supposed to be the same. Not sure why they are different on your computer.
from whitebox-python.
Ok, that makes sense. Thanks for the quick response!
Just to follow up:
The working directory is my project directory, and then I use a relative path to the data folder where all the data is. Is that not correct? I am working with a lot of data in separate directories, should I explicitly set the wbt.set_working_dir() each time I run a whitebox function?
from whitebox-python.
You can either provide absolute paths to input files or use wbt.set_working_dir("/absolute/path/to/wd")
, and then you can use relative paths
I noticed that every time a tool is executed, the working directory is changed to the wbt exe path. Therefore, you can no longer use os.getcwd()
to set the working directory. This is the behavior of whitebox_tools.py. It needs to be fixed by @jblindsay. os.chdir(self.exe_path)
is used 10 times in the script. One potential solution is to reset the working directory at the end of a wbt function.
https://github.com/jblindsay/whitebox-tools/blob/master/whitebox_tools.py#L171
cwd = os.getcwd()
os.chdir(self.exe_path)
# at the end
os.chdir(cwd)
from whitebox-python.
This resolved my issue completely. However, I still cannot use relative paths after I use wbt.set_working_dir("/absolute/path/to/wd")
. I was able to work around this, but here is a quick example of when using a relative path after setting the working directory fails:
cwd = os.getcwd()
wbt.set_working_dir(cwd)
wbt.clip_lidar_to_polygon(
i="./data/lidarFile.las",
polygons="./airsheds/TEAK_airshed.shp"
output="./data/lidarClipped.las"
)
Thanks!
from whitebox-python.
Related Issues (20)
- whitebox clip function corrupting output file HOT 2
- Whiteboxtools in AWS Sagemaker HOT 4
- Documentation for raster_calculator tool HOT 1
- Missing GLIBC library error with Python module HOT 8
- Running ConditionalEvaluation requires manual Whitebox library folder permissions change HOT 2
- ResourceWarnings for unclosed HOT 1
- LidarIdwInterpolation does not save CRS to output
- LidarIdwInterpolation does not save CRS to output HOT 1
- Using previous versions of WhiteboxTools HOT 8
- a bug in func (raster_to_vector_lines) HOT 3
- Raster shift in LidarPointStats? HOT 1
- Discontinuous streams HOT 5
- Negative flow path length HOT 1
- failed to use the mosaic function HOT 1
- Download_wbt.py Error HOT 10
- AttributeError: module 'whitebox' has no attribute... HOT 2
- Whitebox python lib method lidar_digital_surface_model getting stuck at filtering HOT 2
- Installing whitebox tools gets the dev version - FlightlineOverlap fails HOT 1
- wbe.contours_from_raster doesn't work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from whitebox-python.