[ncl-talk] Defining directories

Barry Lynn barry.h.lynn at gmail.com
Fri Oct 28 06:28:09 MDT 2016


This program works, and can be used by whoever wants to open directories in
this way.



On Fri, Oct 28, 2016 at 3:22 PM, Barry Lynn <barry.h.lynn at gmail.com> wrote:

> Karin:
>
> Thank you.
>
> Now I understand.
>
> Barry
>
> On Fri, Oct 28, 2016 at 12:10 PM, Karin Meier-Fleischer <
> meier-fleischer at dkrz.de> wrote:
>
>> Hi Barry,
>>
>> in line 55 the variable filename is defined as pointer to the opened file
>> dirWRF(n)+"/"+"wrfout_d02_2016-01-23_00:00:00"
>>
>>    filename = addfiles(dirWRF(n)+"/"+"wrfout_d02_2016-01-23_00:00:00",
>> "r")
>>
>> but it should be a string variable
>>
>>   filename = dirWRF(n)+"/"+"wrfout_d02_2016-01-23_00:00:00"
>>
>> and also the line 60 must be uncommented again to use the filename
>> variable to open the file
>>
>>   a = addfile(filename,"r")
>>
>> Bye,
>> Karin
>>
>> Am 28.10.16 um 09:25 schrieb Barry Lynn:
>>
>> Dear NCL-Talk:
>>
>> I added delete(filename) to the program, but now I have another obscure
>> (for me) error.
>>
>> Thank you for your help.
>>
>> fatal:Could not coerce values for operation
>> fatal:["Execute.c":8578]:Execute: Error occurred at or near line 56 in
>> file define_dir.ncl
>>
>>
>> On Wed, Oct 26, 2016 at 4:28 PM, Rick Brownrigg <brownrig at ucar.edu>
>> wrote:
>>
>>> Hi Barry,
>>>
>>> Barry, in your case, the error is telling you exactly what the deal
>>> is...left-hand-side and right-hand-side of the assignment are of
>>> incompatible types.  Specifically, the call to addfiles() at line 54
>>> returns a variable of type FileVariable. However, previously you had set
>>> the type of the variable "filename" as a string, at around line 19. NCL is
>>> strongly typed -- you don't have to declare the type of a variable in
>>> advance, but once fixed (in both data-type and array shape), it sticks,
>>> unless you do one of two things:  i) use the delete statement, ex:
>>> delete(filename) in your case, or ii) use the reassignment operator ":=",
>>> ex, filename := addfile(....)
>>>
>>> Mohammad, you seemingly had two questions, the second of which I never
>>> really understood (about looping over the lat/lon values).  For the first
>>> one, regarding multiple directories, it looks like there's a missing "/"
>>> between the directory pathname and the wrf filenames.   Also, I don't
>>> believe addfiles takes a a wildcard pathname, but rather an array of
>>> filenames that may be relative or absolute pathnames.  Dennis's script
>>> shows how to do that, but NOTE, there may be missing a "/" between the
>>> parent directory and the "runXXX" directories.  You'll want to look
>>> carefully at the constructed filenames.
>>>
>>> Hope that helps...
>>> Rick
>>>
>>>
>>>
>>>
>>> On Wed, Oct 26, 2016 at 1:23 AM, Muhammad Omer Mughal <
>>> m.mughal1 at postgrad.curtin.edu.au> wrote:
>>>
>>>> Hi Bary
>>>>
>>>>
>>>> I am in the same sort of problem.  I told you before when I try to run
>>>> the attached script, it is unable to find wrfout_d04 files in all folders
>>>>
>>>> run6
>>>>
>>>> run7
>>>>
>>>> run 8 and
>>>>
>>>> run9
>>>>
>>>>
>>>> I tried to be as clear as possible in NCL help but I may not
>>>> have explained properly. If you understand my problem please reply me. I
>>>> see the following errors when  I run the script.
>>>>
>>>>
>>>> Variable: dirWRF
>>>> Type: string
>>>> Total Size: 32 bytes
>>>>             4 values
>>>> Number of Dimensions: 1
>>>> Dimensions and sizes:    [4]
>>>> Coordinates:
>>>> (0)    /media/mughal/Seagate/ECMWF_WRF_RUNS2/run6
>>>> (1)    /media/mughal/Seagate/ECMWF_WRF_RUNS2/run7
>>>> (2)    /media/mughal/Seagate/ECMWF_WRF_RUNS2/run8
>>>> (3)    /media/mughal/Seagate/ECMWF_WRF_RUNS2/run9
>>>> fatal:["FileSupport.c":2859]:_NclVerifyFile: Requested file
>>>> </media/mughal/Seagate/ECMWF_WRF_RUNS2/run6wrfout_d04*> or
>>>> </media/mughal/Seagate/ECMWF_WRF_RUNS2/run6wrfout_d> does not exist
>>>>
>>>>
>>>> Even when I change the script wrf_script_r4 to wrf_script_r5
>>>> recommended by Dennis I still am not able to solve the problem. I would
>>>> appreciate if you would be able to help me out
>>>>
>>>>
>>>>
>>>> Muhammad Omer Mughal
>>>> MSc BSc Mechanical Engineering
>>>> PhD  Research Scholar
>>>> Remote Sensing and Satellite Research Group
>>>> Department of Imaging and Applied Physics
>>>> Curtin University
>>>>
>>>> Curtin University
>>>> Tel | +61 8 9266 7962
>>>> Fax | +61 8 9266 2377
>>>> Mobile | 0470 237 525
>>>>
>>>> Email | m.mughal1 at postgrad.curtin.edu.au <m.lynch at curtin.edu.au>
>>>> Web | http://curtin.edu.au
>>>>
>>>> Curtin University is a trademark of Curtin University of Technology.
>>>> CRICOS Provider Code 00301J (WA), 02637B (NSW)
>>>>
>>>>
>>>> ------------------------------
>>>> *From:* ncl-talk-bounces at ucar.edu <ncl-talk-bounces at ucar.edu> on
>>>> behalf of Barry Lynn <barry.h.lynn at gmail.com>
>>>> *Sent:* Wednesday, 26 October 2016 2:48:25 PM
>>>> *To:* ncl-talk at ucar.edu
>>>> *Subject:* [ncl-talk] Defining directories
>>>>
>>>> Hi:
>>>>
>>>> I'd like to define multiple directories.  I assume that I am almost
>>>> "there.
>>>>
>>>> I am getting an error I don't understand.
>>>>
>>>> (0) dirWRF(n) = /data1/wrf/01_23_2016/GEFS/GEFS_00
>>>> fatal:["NclVar.c":1390]:Assignment type mismatch, right hand side
>>>> can't be coerced to type of left hand side
>>>> fatal:["Execute.c":8578]:Execute: Error occurred at or near line 54 in
>>>> file define_dir.ncl
>>>>
>>>> I know that this file exists.
>>>>
>>>> /data1/wrf/01_23_2016/GEFS/GEFS_00/wrfout_d02_2016-01-23_00:00:00
>>>>
>>>> But, I cannot execute the line (see error above):
>>>>
>>>> filename = addfiles(dirWRF(n)+"/"+"wrfout_d02_2016-01-23_00:00:00",
>>>> "r")
>>>>
>>>> Thank you.
>>>>
>>>>
>>>> --
>>>> Barry H. Lynn, Ph.D
>>>> Senior Lecturer,
>>>> The Institute of the Earth Science,
>>>> The Hebrew University of Jerusalem,
>>>> Givat Ram, Jerusalem 91904, Israel
>>>> Tel: 972 547 231 170
>>>> Fax: (972)-25662581
>>>>
>>>> C.E.O, Weather It Is, LTD
>>>> Weather and Climate Focus
>>>> http://weather-it-is.com
>>>> Jerusalem, Israel
>>>> Local: 02 930 9525
>>>> Cell: 054 7 231 170
>>>> Int-IS: x972 2 930 9525
>>>> US 914 432 3108 <914%20432%203108>
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>
>>
>> --
>> Barry H. Lynn, Ph.D
>> Senior Lecturer,
>> The Institute of the Earth Science,
>> The Hebrew University of Jerusalem,
>> Givat Ram, Jerusalem 91904, Israel
>> Tel: 972 547 231 170
>> Fax: (972)-25662581
>>
>> C.E.O, Weather It Is, LTD
>> Weather and Climate Focus
>> http://weather-it-is.com
>> Jerusalem, Israel
>> Local: 02 930 9525
>> Cell: 054 7 231 170
>> Int-IS: x972 2 930 9525
>> US 914 432 3108
>>
>>
>> _______________________________________________
>> ncl-talk mailing listncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> --
>> Dipl. Geophys. Karin Meier-Fleischer
>> Visualization, NCL
>> Application Support
>>
>> Deutsches Klimarechenzentrum GmbH (DKRZ)
>> Bundesstrasse 45a - D20146 Hamburg - Germany
>>
>> Phone:    +49 (0)40 460094 126
>> Fax:      +49 (0)40 460094 270
>> E-Mail:   meier-fleischer at dkrz.de
>> URL:      www.dkrz.de
>>
>> Geschäftsführer: Prof. Dr. Thomas Ludwig
>> Sitz der Gesellschaft: Hamburg
>> Amtsgericht Hamburg HRB 39784
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> Barry H. Lynn, Ph.D
> Senior Lecturer,
> The Institute of the Earth Science,
> The Hebrew University of Jerusalem,
> Givat Ram, Jerusalem 91904, Israel
> Tel: 972 547 231 170
> Fax: (972)-25662581
>
> C.E.O, Weather It Is, LTD
> Weather and Climate Focus
> http://weather-it-is.com
> Jerusalem, Israel
> Local: 02 930 9525
> Cell: 054 7 231 170
> Int-IS: x972 2 930 9525
> US 914 432 3108
>



-- 
Barry H. Lynn, Ph.D
Senior Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581

C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
US 914 432 3108
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161028/bf196e4c/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: define_dir.ncl
Type: application/octet-stream
Size: 1922 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161028/bf196e4c/attachment.obj 


More information about the ncl-talk mailing list