Closed mberry28 closed 6 years ago
this is a shell issue really. It probably means that you have a different $path seen by tisc and in your shell. when TISC calls tisc.gmt.job it probably finds another script, not the one in your working path.
try to print your path from the system call, for instance, and see if /tisc/script is defined earlier than "." in the list. That could be it.
On Fri, Oct 20, 2017 at 3:52 AM, Michael Berry notifications@github.com wrote:
Hopefully, I can be clear about this issue:
Using I made some small adaptions to tisc.river_profile.gmt.job so that I could get a plot of the river profiles (there is still a few issues, but that's another story). I wanted to have TISC plot a new river profiles instead of the normal tisc.gmt.job.
Executing the file in the terminal command line ('./tisc.river_profile.gmt proj') it seemed to work how I expect it to (see good_profile.jpg). So I renamed tisc.river_profile.gmt.job to tisc.gmt.job. and for some reason, the GMT output goes crazy (see attachment bad_profile.jpg). I tried adding an additional line in the TISC commands to output both the standard tisc.gmt.job and tisc.gmt.river_profiles.gmt.job and the standard figures were working perfectly, just not the river profile image.
I am pretty sure that the system() call that was executing the shell is stepping over some environmental variables. I have tried other workarounds but haven't been successful. Again, it should be clear that if I execute the river profile script from the terminal, it works fine. It just seems to have the problem when it's executed within TISC.
[image: bad_profile] https://user-images.githubusercontent.com/13278376/31801499-d734ba90-b505-11e7-9e3a-085fd4117a7e.jpg [image: good_profile] https://user-images.githubusercontent.com/13278376/31801668-e474a124-b506-11e7-9504-3ddf562d44d6.jpg
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/danigeos/tisc/issues/15, or mute the thread https://github.com/notifications/unsubscribe-auth/ALBQiuAfJ_Krsbt_MRmRNvDZy_A-9v2Oks5st_zJgaJpZM4QAFZ5 .
Thanks for the reply.
Since I have adapted the GMT shell scripts, I usually have tisc.gmt.job in the working directory, and not have it called from the tisc/script/. So my tisc.c code section looks like this:
char command[300]; sprintf(command, "./tisc.gmt.job %s", projectname); if (verbose_level>=3) fprintf(stdout, "\nPostscript file '%s.ps' is going to be produced with command:", projectname) ; if (verbose_level>=3) fprintf(stdout, "\n%s\n", command) ; system(command);
One test I did was I change the tisc.river_profile.gmt.job to tisc.gmt.job in my working directory and it produces the same perturbed figure as above. So I am pretty certain that TISC is correctly calling the right tisc.river_profile.gmt.job (the one in my working directory)
hi, you'll have to place some 'echo's in your script and see what is going different. I see no other way
On Fri, Oct 20, 2017 at 4:47 PM, Michael Berry notifications@github.com wrote:
Thanks for the reply.
Since I have adapted the GMT shell scripts, I usually have tisc.gmt.job in the working directory, and not have it called from the tisc/script/. So my tisc.c code section looks like this:
char command[300]; sprintf(command, "./tisc.gmt.job %s", projectname); if (verbose_level>=3) fprintf(stdout, "\nPostscript file '%s.ps' is going to be produced with command:", projectname) ; if (verbose_level>=3) fprintf(stdout, "\n%s\n", command) ; system(command);
One test I did was I change the tisc.river_profile.gmt.job to tisc.gmt.job in my working directory and it produces the same perturbed figure as above. So I am pretty certain that TISC is correctly calling the right tisc.river_profile.gmt.job (the one in my working directory)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/danigeos/tisc/issues/15#issuecomment-338228194, or mute the thread https://github.com/notifications/unsubscribe-auth/ALBQihs_vcCGPafybGrh94jUHBoiXhNhks5suLKQgaJpZM4QAFZ5 .
Addressing my solution for future researchers:
I am still not sure what exactly the problem was, it certainly was located in the environment not being preserved. I took all the segments from tisc.common.gmt.job that were needed for tisc.river_profile.gmt.job and inserted them all directly into tisc.river_profile.gmt.job and it worked. Like I said, I am still not sure why it would work fine in the command line, but have issues when executed in TISC.
Hopefully, I can be clear about this issue:
Using I made some small adaptions to tisc.river_profile.gmt.job so that I could get a plot of the river profiles (there is still a few issues, but that's another story). I wanted to have TISC plot a new river profiles instead of the normal tisc.gmt.job.
Executing the file in the terminal command line ('./tisc.river_profile.gmt proj') it seemed to work how I expect it to (see good_profile.jpg). So I renamed tisc.river_profile.gmt.job to tisc.gmt.job. and for some reason, the GMT output goes crazy (see attachment bad_profile.jpg). I tried adding an additional line in the TISC commands to output both the standard tisc.gmt.job and tisc.gmt.river_profiles.gmt.job and the standard figures were working perfectly, just not the river profile image.
I am pretty sure that the system() call that was executing the shell is stepping over some environmental variables. I have tried other workarounds but haven't been successful. Again, it should be clear that if I execute the river profile script from the terminal, it works fine. It just seems to have the problem when it's executed within TISC.