Closed mcgarth closed 8 years ago
Garrick I believe has already done this.
I have done this but it's using regular tiff files. I discussed with Matt that for the prepifg output, since pyrate is using the data in those files, we can't change the data at all. The best we can do with those files is to modify ColorInterp=Gray.
For the output file I've been simply creating a regular tiff with RGB data with each channel having an integer between 0 and 255. This gives a good visualization of data, but it's not good in the sense that the file contains no information of the actual values each pixel takes (e.g. for the ratemap, it doesn't give you the actual m/s value for each pixel)...
There must be some way to define a color funtion in the tiff file that keeps the actual data (e.g. m/s) in the file, but when opened with an image viewer, applies the appropriate color map.
I will look into this.
Garrick, Here is a starter script.
Usage is documented in the script too.
sydney_trimmed.tif can be converted into something like this with this script:
I have added optional auto colour option. This is how the dem looks like with auto colour:
Script updated with new instructions. It can handle both dem and ifgs.
@basaks I just sent you an email Matt forward me about having gdaldem functionality in a python module (rasterio). This may be better than calling the executable with subprocess. I'm not sure if this module supports the auto color map though.
Also. I'm wondering if it would be good to have the RGBA channels as well as the float channel for ifgs and pyrate output. I think you can do this. I'll look into it.
rasterio
is a nice wrapper. I have thought of using it in PyRate
for other functionalities too.
Let's wait for what Matt has to say before we do more work on this? What we already have in gdaldem
might be all we need for now.
@basaks :Using gdaldem.py for plotting the outcome of run_pyrate.py in rhe-compute and pycharm both gave me this outcome for either auto or custom color scale: The command that I used in "Pyrate" folder: python pyrate/utils/gdaldem.py /nas/gemd/insar/Users/Moghaddam/surat_test/plot/20080808-20080901_HH_4rlks_utm.tif auto out_tif.tif
The message:
Traceback (most recent call last):
File "pyrate/utils/gdaldem.py", line 26, in
Can PyRate be found in your PYTHONPATH? Have you done this?
export PYRATEPATH="/home/sudipta/GA/PyRate"
export PYTHONPATH=$PYRATEPATH/:$PYTHONPATH
I can not see my .bashrc in my unix folder. I dont know what happened to it. it was already in my unix folder that i simply source it before. !!! However, I used the following set for the path again
export HTTPS_PROXY=http://u15197:pass@proxy.ga.gov.au:8080 export HTTP_PROXY=http://u15197:pass@proxy.ga.gov.au:8080 export PYTHONPATH=/nas/users/u15197/unix/PyRate:$PYTHONPATH
No change....
I just did python pyrate/utils/gdaldem.py tests/sydney_test/dem/sydney_trimmed.tif auto out_tif.tif
It works. You have to fix your paths and environment.
Are prepifg and run_pyrate working?
Ask @gp8899 .
@basaks : yes of course.
@basaks: In rhe-compute i set the environment and run the same code that you used above, but the same error showed up:
(pyrate_new)-bash-4.2$ cd PyRate/
(pyrate_new)-bash-4.2$ python pyrate/utils/gdaldem.py tests/sydney_test/dem/sydney_trimmed.tif auto out_tif.tif
Traceback (most recent call last):
File "pyrate/utils/gdaldem.py", line 26, in
on rhecompute fire up a python shell..and use that command:
ipython
from pyrate.shared import Ifg, DEM
If that does not work, this script won't work either. Is run_prepifg and run_pyrate working?
Yes, run_prepifg and run_pyrate both are working for the new dataset.
on nci
python pyrate/utils/gdaldem.py tests/sydney_test/dem/sydney_trimmed.tif auto out_tif.tif
auto generating color file
color file contents
==================================================
222 black
252 blue
282 yellow
311 orange
341 red
342 white
==================================================
0...10...20...30...40...50...60...70...80...90...100 - done.
Did you do those?
ipython
from pyrate.shared import Ifg, DEM
What's the output?
In rhe-compute when I do : ipython it gives me the following trackback error:
pyrate_new)-bash-4.2$ ipython
Traceback (most recent call last):
File "/usr/bin/ipython", line 5, in
If you suspect this is an IPython bug, please report it at: https://github.com/ipython/ipython/issues or send an email to the mailing list at ipython-dev@scipy.org
You can print a more detailed traceback right now with "%tb", or use "%debug" to interactively debug it.
Extra-detailed tracebacks for bug-reporting purposes can be enabled via: c.Application.verbose_crash=True
conda install ipython
Then redo.
I ran the command... it could not install them and wanted me to do "conda create -n my_pyrate_new --clone=/nas/users/u15197/unix/anaconda2/envs/pyrate_new" I did and then I sourced the new environment " my_pyrate_new" then i ran the install command again but it gave me bunch of errors: (my_pyrate_new)-bash-4.2$ conda install ipython Fetching package metadata: .... Solving package specifications: ................An unexpected error has occurred, please consider sending the following traceback to the conda GitHub issue tracker at:
https://github.com/conda/conda/issues
Include the output of the command 'conda info' in your report.
Traceback (most recent call last):
File "/nas/users/u15197/unix/.conda/envs/my_pyrate_new/bin/conda", line 5, in
Don't worry about ipython
.
In your conda environment, you should be able to use:
python
from pyrate.shared import Ifg, DEM
If that does not work, I can't explain why you can use run_pyrate/prepifg
, but not utils/gdaldem
.
Sure. This is the outcome of calling the command directly in python (pyrate_new)-bash-4.2$ python Python 2.7.11 |Continuum Analytics, Inc.| (default, Dec 6 2015, 18:08:32) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://anaconda.org
from pyrate.shared import Ifg, DEM Traceback (most recent call last): File "
", line 1, in ImportError: No module named pyrate.shared
Use nci for now :)
Use these after you login:
module rm intel-fc intel-cc
module load intel-mkl
module load python/2.7.6
module load python/2.7.6-matplotlib
module rm openmpi/1.6.3
module load openmpi/1.8
module load gdal/1.11.1-python
module load grib_api/1.12.3
module load pypar/30May-2.7.6-1.8
export PYRATEPATH=/g/data/dg9/sudipta/PyRate
PYTHONPATH=$PYRATEPATH:$PYTHONPATH
PYTHONPATH=/g/data/dg9/sudipta/PyRate:/g/data/dg9/sudipta/site-packages:$PYTHONPATH
export PYTHONPATH
Then
cd PyRate
python pyrate/utils/gdaldem.py tests/sydney_test/dem/sydney_trimmed.tif auto out_tif.tif
Works fine.
I used the " inspect_output.py". It was working pretty good for my plotting purpose.
That's good, but you should address why you can't use
from pyrate.shared import Ifg, DEM
Chances are you will will get stuck again.
@basaks I logged into the nci... and used the ones you mentioned... seems that I did not get there...
[nfm547@raijin1 ~]$ module rm intel-fc intel-cc [nfm547@raijin1 ~]$ module load intel-mkl [nfm547@raijin1 ~]$ module load python/2.7.6 [nfm547@raijin1 ~]$ module load python/2.7.6-matplotlib [nfm547@raijin1 ~]$ module rm openmpi/1.6.3 [nfm547@raijin1 ~]$ module load openmpi/1.8 [nfm547@raijin1 ~]$ module load gdal/1.11.1-python [nfm547@raijin1 ~]$ module load grib_api/1.12.3 [nfm547@raijin1 ~]$ module load pypar/30May-2.7.6-1.8 [nfm547@raijin1 ~]$ export PYRATEPATH=/g/data/dg9/sudipta/PyRate [nfm547@raijin1 ~]$ PYTHONPATH=$PYRATEPATH:$PYTHONPATH [nfm547@raijin1 ~]$ PYTHONPATH=/g/data/dg9/sudipta/PyRate:/g/data/dg9/sudipta/site-packages:$PYTHONPATH [nfm547@raijin1 ~]$ export PYTHONPATH [nfm547@raijin1 ~]$ cd PyRate bash: cd: PyRate: No such file or directory
Change these lines to your PyRate location in NCI.
export PYRATEPATH=/g/data/dg9/sudipta/PyRate
If you have accesss to /g/data/dg9/sudipta/PyRate:/g/data/dg9/sudipta/site-packages
, then cd in your PyRate
in NCI.
I have access to /g/data/dg9/sudipta/PyRate but I dont have my own "Pyrate location" in NCI. Maybe I need to set up there...
Yes, just do a git clone Pyrate in NCI.
ok I cloned it through this command : git clone /g/data/dg9/sudipta/PyRate into my own directory in NCI. Now i will go up to follow the instruction.
@basaks : Successful running the gdaldem.py using test data... :)
Now for my case, should I put the images I want to plot on NCI. Could be directed to the /nas/gemd/.. for instance...
yea, put the full path for the output file, or you can use scp to transfer to your pc.
So far it is working for the files similar to this type: date1-date2_HH_4rlks_utm_5rlks_4cr.tif but for the "linearrate" it gives me the following error that is related to the values probably in this file that is not compatible with the colorscale..
[nfm547@gamma PyRate]$ python pyrate/utils/gdaldem.py images/linrate.tif auto images/Linerate_out.tif
auto generating color file
/apps/python/2.7.6/lib/python2.7/site-packages/numpy/lib/nanfunctions.py:319: RuntimeWarning: All-NaN slice encountered
warnings.warn("All-NaN slice encountered", RuntimeWarning)
/apps/python/2.7.6/lib/python2.7/site-packages/numpy/lib/nanfunctions.py:220: RuntimeWarning: All-NaN axis encountered
warnings.warn("All-NaN axis encountered", RuntimeWarning)
Traceback (most recent call last):
File "pyrate/utils/gdaldem.py", line 62, in
It's likely that you phase_data is all nan
's, i.e. zeros
and then nan_converted
.
The result for plotting looks good. I might try the custome color scale.
Hmm. Might be since I had a number of parameters zero in my configuration file including tscal.
I think we can close this issue now. There are two different implementations now for this.
Currently Geotiffs produced by GDAL in PyRate are in grey-scale. It would be better if a rainbow colour scale was applied with all images scaled for min-max of the entire dataset (i.e. all input ifgs or all time series slices) so quickviews of the geotiffs can be quickly compared.