Re: problem with spaces in path

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Wed Aug 29 2012 - 13:02:06 MDT

All,

Would a symbolic link be a good workaround? Set it up one time, then
keep the NCL script uncomplicated.

cd /home/user/
ln -s directory\ with\ spaces ncl_output

then ...

opath = "/home/user/ncl_output/"
fn = "map"
wks = gsn_open_wks("png", opath+fn)

--Dave

On Wed, Aug 29, 2012 at 12:13 PM, Adam Phillips <asphilli@ucar.edu> wrote:
> Hi Xavier,
> This behavior seems to be localized to gsn_open_wks.. Other NCL
> functions seem to accept directory names with spaces. I was able to
> specify a directory with spaces in asciiwrite, for instance. A NCL
> developer will have to look at this.
>
> The work around is to either change the name of your directory or to
> open a workstation window in a different directory and move the
> resulting file when the script is compete:
>
> opath = "/home/user/"
> fn = "map"
> wks = gsn_open_wks("png", opath+fn)
> .......
> delete(wks)
> npath = "/home/user/directory\ with\ spaces/"
> system("mv "+opath+fn".png "+npath+fn+".png")
>
> Hope that helps! Adam
>
> On 08/29/2012 10:25 AM, Alan Brammer wrote:
>> My bad, didn't actually test that, just presumed that would work, will hang my head sheepishly. I get the same result as you. I'm not sure about your answer then.
>>
>>
>> Alan.
>>
>>
>>
>>
>> On Aug 29, 2012, at 11:00 AM, Alan Brammer <abrammer@albany.edu> wrote:
>>
>>> To reference a directory or file name with spaces, you need a \ before the space. This is standard when using a command line prompt.
>>>
>>> e.g. "/home/user/directory\ with\ spaces/map"
>>>
>>>
>>> Alan.
>>>
>>> -------------------------------------
>>> Alan Brammer,
>>> PhD Student
>>>
>>> Department of Atmospheric and Environmental Sciences, University at
>>> Albany, SUNY, Albany, NY, 12222
>>>
>>> -------------------------------------
>>>
>>>
>>> On Aug 29, 2012, at 10:43 AM, Xavier Corredor Llano <xcorredorl@unal.edu.co> wrote:
>>>
>>>> Hi
>>>>
>>>> I have a problem with spaces in the path name in function gsn_open_wsk when I
>>>> want save the image in directory with spaces in its name, for example:
>>>>
>>>> wks = gsn_open_wks("png", "/home/user/directory with spaces/map")
>>>>
>>>> the image saved in "/home/user/directory" and it is wrong, are there any
>>>> special character for include spaces in path to save image?
>>>>
>>>> I know that this work if I first go to directory and then run script with
>>>> "map", but this does not solved my problem.
>>>>
>>>> thanks in advance
>>>> regards
>>>>
>>>> --
>>>> Xavier Corredor Llano
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> --
> ______________________________________________________________
> Adam Phillips asphilli@ucar.edu
> NCAR/Climate and Global Dynamics Division (303) 497-1726
> P.O. Box 3000
> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Aug 29 13:02:15 2012

This archive was generated by hypermail 2.1.8 : Tue Sep 11 2012 - 15:30:42 MDT