public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Data file access on different path (drive)
@ 2015-11-23  8:54 Lester Anderson
  2015-11-23  8:57 ` Marco Atzeri
  0 siblings, 1 reply; 9+ messages in thread
From: Lester Anderson @ 2015-11-23  8:54 UTC (permalink / raw)
  To: cygwin

Hello,

I am fairly new to using Cygwin, so hope that this query is not too simplistic.

I have a bash script that integrates a lot of GMT commands and also
calls a Fortran program to generate a map output. Now the problem is
how to get the script/Cygwin to access two data files on a different
drive (Q:) to the script location (C:/test).

In addition, it also needs to run a Fortran program, so not sure how that works.

The data read front looks like this (the parts that are problematic):


ruta_elev="Q:/geophys/Potential-field datasets/Topography/topo_17.1.img"
ruta_grav="Q:/geophys/Potential-field datasets/Gravity/grav.img.23.1"

img2grd $ruta_elev  -V -T1
-R$lon_e_min/$lon_e_max/$lat_e_min/$lat_e_max -S1 -Gelev.grd -m1
img2grd $ruta_grav -T1 -V
-R$lon_e_min/$lon_e_max/$lat_e_min/$lat_e_max -S0.1 -GFA.grd -m1
.... etc
#Call FA2Boug (Fortran) program to calculate Bouguer anomaly
time  ./FA2Boug_final
... etc

I have not so far managed to get the script to access the data files
and thus the rest of the script does not work.
Although one can cd to the location with the " " method (it has a
space in the folder name).

$ cd "Q:/geophys/Potential-field datasets/Topography/"
/cygdrive/q/geophys/Potential-field datasets/Topography

The issue seems to be that $ruta_elev (for example) points to the file
topo_17.1.img but does not seem to assign the name when pointing to a
different drive. I am sure it would work with the files in the same
directory, but these are large!

Any pointers on how this should work would be helpful.

Lester

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Data file access on different path (drive)
  2015-11-23  8:54 Data file access on different path (drive) Lester Anderson
@ 2015-11-23  8:57 ` Marco Atzeri
  2015-11-23  9:51   ` Lester Anderson
  0 siblings, 1 reply; 9+ messages in thread
From: Marco Atzeri @ 2015-11-23  8:57 UTC (permalink / raw)
  To: cygwin



On 23/11/2015 09:54, Lester Anderson wrote:
> Hello,
>
> I am fairly new to using Cygwin, so hope that this query is not too simplistic.
>
> I have a bash script that integrates a lot of GMT commands and also
> calls a Fortran program to generate a map output. Now the problem is
> how to get the script/Cygwin to access two data files on a different
> drive (Q:) to the script location (C:/test).
>
> In addition, it also needs to run a Fortran program, so not sure how that works.
>
> The data read front looks like this (the parts that are problematic):
>
>
> ruta_elev="Q:/geophys/Potential-field datasets/Topography/topo_17.1.img"
> ruta_grav="Q:/geophys/Potential-field datasets/Gravity/grav.img.23.1"

Try:

ruta_grav="cygdrive/q/geophys/Potential-field datasets/Gravity/grav.img.23

and
/cygdrive/c/test

> img2grd $ruta_elev  -V -T1
> -R$lon_e_min/$lon_e_max/$lat_e_min/$lat_e_max -S1 -Gelev.grd -m1
> img2grd $ruta_grav -T1 -V
> -R$lon_e_min/$lon_e_max/$lat_e_min/$lat_e_max -S0.1 -GFA.grd -m1
> .... etc
> #Call FA2Boug (Fortran) program to calculate Bouguer anomaly
> time  ./FA2Boug_final
> ... etc
>
> I have not so far managed to get the script to access the data files
> and thus the rest of the script does not work.
> Although one can cd to the location with the " " method (it has a
> space in the folder name).
>
> $ cd "Q:/geophys/Potential-field datasets/Topography/"
> /cygdrive/q/geophys/Potential-field datasets/Topography
>
> The issue seems to be that $ruta_elev (for example) points to the file
> topo_17.1.img but does not seem to assign the name when pointing to a
> different drive. I am sure it would work with the files in the same
> directory, but these are large!
>
> Any pointers on how this should work would be helpful.
>
> Lester
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Data file access on different path (drive)
  2015-11-23  8:57 ` Marco Atzeri
@ 2015-11-23  9:51   ` Lester Anderson
  2015-11-23  9:59     ` Marco Atzeri
  2015-11-23 10:23     ` Peter Rosin
  0 siblings, 2 replies; 9+ messages in thread
From: Lester Anderson @ 2015-11-23  9:51 UTC (permalink / raw)
  To: cygwin

Hello,

I tried a very basic script to test this:

#!/bin/bash
ruta_elev="cygdrive/q/geophys/Potential-field datasets/Topography/topo_17.1.img"
ruta_grav="cygdrive/q/geophys/Potential-field datasets/Gravity/grav.img.23.1"
# Also tried
# ruta_elev="Q:/geophys/Potential-field datasets/Topography/topo_17.1.img"
# ruta_grav="Q:/geophys/Potential-field datasets/Gravity/grav.img.23.1"
lon_min=-12
lon_max=0
lat_min=28
lat_max=39
img2grd $ruta_elev  -V -T1 -R$lon_min/$lon_max/$lat_min/$lat_max -S1
-Gelev.grd -m1
img2grd $ruta_grav -T1 -V -R$lon_min/$lon_max/$lat_min/$lat_max -S0.1
-GFA.grd -m1

So pointing to the correct dataset location (from the script location
eg c:/gmt_scripta/test) and it still does not work.

$ bash test4.sh
-12 0 28 39
img2grd: Error for input file: No such file
(Q:/geophys/Potential-field) <- does not recognise the path with space
(or filename) yet can cd to this location - see below!
img2grd: Syntax error: Must specify input imgfile name.
img2grd: Syntax error: More than one world image file name given.
img2grd: Error for input file: No such file (Q:/geophys/Potential-field)
img2grd: Syntax error: Must specify input imgfile name.
img2grd: Syntax error: More than one world image file name given.

Tested cd to directories:

$ cd "cygdrive/q/geophys/Potential-field datasets/Topography"
-bash: cd: cygdrive/q/geophys/Potential-field datasets/Topography: No
such file or directory

$ cd "cygdrive/q/geophys/Potential-field datasets/Topography/"
-bash: cd: cygdrive/q/geophys/Potential-field datasets/Topography/: No
such file or directory

However this works:

$ cd "q:/geophys/Potential-field datasets/Topography/"
$ pwd
/cygdrive/q/geophys/Potential-field datasets/Topography

$ cd "q:/geophys/Potential-field datasets/gravity/"
$ pwd
/cygdrive/q/geophys/Potential-field datasets/gravity

At a loss as to how this works.

Lester

On 23 November 2015 at 08:57, Marco Atzeri <marco.atzeri@gmail.com> wrote:
>
>
> On 23/11/2015 09:54, Lester Anderson wrote:
>>
>> Hello,
>>
>> I am fairly new to using Cygwin, so hope that this query is not too
>> simplistic.
>>
>> I have a bash script that integrates a lot of GMT commands and also
>> calls a Fortran program to generate a map output. Now the problem is
>> how to get the script/Cygwin to access two data files on a different
>> drive (Q:) to the script location (C:/test).
>>
>> In addition, it also needs to run a Fortran program, so not sure how that
>> works.
>>
>> The data read front looks like this (the parts that are problematic):
>>
>>
>> ruta_elev="Q:/geophys/Potential-field datasets/Topography/topo_17.1.img"
>> ruta_grav="Q:/geophys/Potential-field datasets/Gravity/grav.img.23.1"
>
>
> Try:
>
> ruta_grav="cygdrive/q/geophys/Potential-field datasets/Gravity/grav.img.23
>
> and
> /cygdrive/c/test
>
>> img2grd $ruta_elev  -V -T1
>> -R$lon_e_min/$lon_e_max/$lat_e_min/$lat_e_max -S1 -Gelev.grd -m1
>> img2grd $ruta_grav -T1 -V
>> -R$lon_e_min/$lon_e_max/$lat_e_min/$lat_e_max -S0.1 -GFA.grd -m1
>> .... etc
>> #Call FA2Boug (Fortran) program to calculate Bouguer anomaly
>> time  ./FA2Boug_final
>> ... etc
>>
>> I have not so far managed to get the script to access the data files
>> and thus the rest of the script does not work.
>> Although one can cd to the location with the " " method (it has a
>> space in the folder name).
>>
>> $ cd "Q:/geophys/Potential-field datasets/Topography/"
>> /cygdrive/q/geophys/Potential-field datasets/Topography
>>
>> The issue seems to be that $ruta_elev (for example) points to the file
>> topo_17.1.img but does not seem to assign the name when pointing to a
>> different drive. I am sure it would work with the files in the same
>> directory, but these are large!
>>
>> Any pointers on how this should work would be helpful.
>>
>> Lester
>>
>> --
>> Problem reports:       http://cygwin.com/problems.html
>> FAQ:                   http://cygwin.com/faq/
>> Documentation:         http://cygwin.com/docs.html
>> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>>
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Data file access on different path (drive)
  2015-11-23  9:51   ` Lester Anderson
@ 2015-11-23  9:59     ` Marco Atzeri
  2015-11-23 10:11       ` Lester Anderson
  2015-11-23 10:23     ` Peter Rosin
  1 sibling, 1 reply; 9+ messages in thread
From: Marco Atzeri @ 2015-11-23  9:59 UTC (permalink / raw)
  To: cygwin



On 23/11/2015 10:51, Lester Anderson wrote:
> Hello,
>
> I tried a very basic script to test this:
>
> #!/bin/bash
> ruta_elev="cygdrive/q/geophys/Potential-field datasets/Topography/topo_17.1.img"
> ruta_grav="cygdrive/q/geophys/Potential-field datasets/Gravity/grav.img.23.1"

sorry typo "/cygdrive/q.."
you need the leading "/"


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Data file access on different path (drive)
  2015-11-23  9:59     ` Marco Atzeri
@ 2015-11-23 10:11       ` Lester Anderson
  2015-11-23 10:19         ` Marco Atzeri
  0 siblings, 1 reply; 9+ messages in thread
From: Lester Anderson @ 2015-11-23 10:11 UTC (permalink / raw)
  To: cygwin

Tested the change:
ruta_elev="/cygdrive/q/geophys/Potential-field
datasets/Topography/topo_17.1.img"
ruta_grav="/cygdrive/q/geophys/Potential-field datasets/Gravity/grav.img.23.1"

No errors reported for the path but..
$ bash test4.sh
-12 0 28 39
img2grd: Syntax error: More than one world image file name given.
img2grd: Syntax error: More than one world image file name given.

There are only one file to read in each directory as listed in the
path so not sure why it is confused!


On 23 November 2015 at 09:58, Marco Atzeri <marco.atzeri@gmail.com> wrote:
>
>
> On 23/11/2015 10:51, Lester Anderson wrote:
>>
>> Hello,
>>
>> I tried a very basic script to test this:
>>
>> #!/bin/bash
>> ruta_elev="cygdrive/q/geophys/Potential-field
>> datasets/Topography/topo_17.1.img"
>> ruta_grav="cygdrive/q/geophys/Potential-field
>> datasets/Gravity/grav.img.23.1"
>
>
> sorry typo "/cygdrive/q.."
> you need the leading "/"
>
>
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Data file access on different path (drive)
  2015-11-23 10:11       ` Lester Anderson
@ 2015-11-23 10:19         ` Marco Atzeri
  0 siblings, 0 replies; 9+ messages in thread
From: Marco Atzeri @ 2015-11-23 10:19 UTC (permalink / raw)
  To: cygwin

On 23/11/2015 11:11, Lester Anderson wrote:
> Tested the change:
> ruta_elev="/cygdrive/q/geophys/Potential-field
> datasets/Topography/topo_17.1.img"
> ruta_grav="/cygdrive/q/geophys/Potential-field datasets/Gravity/grav.img.23.1"
>
> No errors reported for the path but..
> $ bash test4.sh
> -12 0 28 39
> img2grd: Syntax error: More than one world image file name given.
> img2grd: Syntax error: More than one world image file name given.
>
> There are only one file to read in each directory as listed in the
> path so not sure why it is confused!
>

there is a space in the path, so bash see two separated names

ruta_grav="/cygdrive/q/geophys/Potential-field 
datasets/Gravity/grav.img.23.1"

try renaming the directory from
  "Potential-field datasets" to "Potential-field_datasets"




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Data file access on different path (drive)
  2015-11-23  9:51   ` Lester Anderson
  2015-11-23  9:59     ` Marco Atzeri
@ 2015-11-23 10:23     ` Peter Rosin
  2015-11-23 11:12       ` Lester Anderson
  1 sibling, 1 reply; 9+ messages in thread
From: Peter Rosin @ 2015-11-23 10:23 UTC (permalink / raw)
  To: cygwin


On 2015-11-23 10:51, Lester Anderson wrote:
> Hello,
>
> I tried a very basic script to test this:
>
> #!/bin/bash
> ruta_elev="cygdrive/q/geophys/Potential-field datasets/Topography/topo_17.1.img"
> ruta_grav="cygdrive/q/geophys/Potential-field datasets/Gravity/grav.img.23.1"
> # Also tried
> # ruta_elev="Q:/geophys/Potential-field datasets/Topography/topo_17.1.img"
> # ruta_grav="Q:/geophys/Potential-field datasets/Gravity/grav.img.23.1"
> lon_min=-12
> lon_max=0
> lat_min=28
> lat_max=39
> img2grd $ruta_elev  -V -T1 -R$lon_min/$lon_max/$lat_min/$lat_max -S1
In addition to the typo with the leading slash, you also need to quote the file path here,
like so:

img2grd "$ruta_elev"  -V -T1 -R$lon_min/$lon_max/$lat_min/$lat_max -S1


Cheers,
Peter

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Data file access on different path (drive)
  2015-11-23 10:23     ` Peter Rosin
@ 2015-11-23 11:12       ` Lester Anderson
  2015-11-23 14:51         ` cyg Simple
  0 siblings, 1 reply; 9+ messages in thread
From: Lester Anderson @ 2015-11-23 11:12 UTC (permalink / raw)
  To: cygwin

Thanks Peter! Finally got the test script to run :

#!/bin/bash
ruta_elev="Q:/geophys/Potential-field datasets/Topography/topo_17.1.img"
ruta_grav="Q:/geophys/Potential-field datasets/Gravity/grav.img.23.1"
lon_min=-12
lon_max=0
lat_min=28
lat_max=39
echo $lon_min $lon_max $lat_min $lat_max
img2grd "$ruta_elev"  -V -T1 -R$lon_min/$lon_max/$lat_min/$lat_max -S1
-Gelev.grd -I1m -D
img2grd "$ruta_grav" -T1 -V -R$lon_min/$lon_max/$lat_min/$lat_max
-S0.1 -GFA.grd -I1m -D

Using the path as Q:/... worked but the Cygrdrive/q/... did not.

Lester

On 23 November 2015 at 10:23, Peter Rosin <peda@lysator.liu.se> wrote:
>
> On 2015-11-23 10:51, Lester Anderson wrote:
>> Hello,
>>
>> I tried a very basic script to test this:
>>
>> #!/bin/bash
>> ruta_elev="cygdrive/q/geophys/Potential-field datasets/Topography/topo_17.1.img"
>> ruta_grav="cygdrive/q/geophys/Potential-field datasets/Gravity/grav.img.23.1"
>> # Also tried
>> # ruta_elev="Q:/geophys/Potential-field datasets/Topography/topo_17.1.img"
>> # ruta_grav="Q:/geophys/Potential-field datasets/Gravity/grav.img.23.1"
>> lon_min=-12
>> lon_max=0
>> lat_min=28
>> lat_max=39
>> img2grd $ruta_elev  -V -T1 -R$lon_min/$lon_max/$lat_min/$lat_max -S1
> In addition to the typo with the leading slash, you also need to quote the file path here,
> like so:
>
> img2grd "$ruta_elev"  -V -T1 -R$lon_min/$lon_max/$lat_min/$lat_max -S1
>
>
> Cheers,
> Peter
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Data file access on different path (drive)
  2015-11-23 11:12       ` Lester Anderson
@ 2015-11-23 14:51         ` cyg Simple
  0 siblings, 0 replies; 9+ messages in thread
From: cyg Simple @ 2015-11-23 14:51 UTC (permalink / raw)
  To: cygwin

On 11/23/2015 6:12 AM, Lester Anderson wrote:
> 
> Using the path as Q:/... worked but the Cygrdrive/q/... did not.
> 

Because as Marco already pointed out it is /cygdrive/q/ and not
cygdrive/q/.  Q:/ works just because it is a Windows supported method
but the preferred method is /cygdrive/q/.  Note there are ways to reduce
/cygdrive/ to / if you want to research the FAQ for it.

-- 
cyg Simple

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-11-23 14:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-23  8:54 Data file access on different path (drive) Lester Anderson
2015-11-23  8:57 ` Marco Atzeri
2015-11-23  9:51   ` Lester Anderson
2015-11-23  9:59     ` Marco Atzeri
2015-11-23 10:11       ` Lester Anderson
2015-11-23 10:19         ` Marco Atzeri
2015-11-23 10:23     ` Peter Rosin
2015-11-23 11:12       ` Lester Anderson
2015-11-23 14:51         ` cyg Simple

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).