Re: File unit problems [message #56559] |
Mon, 29 October 2007 04:25 |
ben.bighair
Messages: 221 Registered: April 2007
|
Senior Member |
|
|
On Oct 29, 4:08 am, Sheldon <shejo...@gmail.com> wrote:
> Hi!
>
> I am having some trouble with the file unit in IDL. I have included
> the part of code that the error occurrs.
>
> FOR f = 0, 1 DO BEGIN
> IF f EQ 0 THEN BEGIN
> OPENR, 1, land_lut, /GET_LUN; IDL says that this line is
> incorrect. See error message below.
> TITLESTR="Unmodified Class probability LUT for Land (Perhaps
> erroneous)"
> OPENW, 2, "land_scat_clas_tuned.dat", /GET_LUN
> FILESTR = "land_scat_clas_tuned.ps"
> ENDIF ELSE BEGIN
> TITLESTR = "Unmodified Class probability LUT for Ocean
> (Perhaps erroneous)"
> OPENR, 1, sea_lut, /GET_LUN
> OPENW, 2, "sea_scat_clas_tuned.dat", /GET_LUN
> FILESTR = "sea_scat_clas_tuned.ps"
> ENDELSE
> ....
>
> % OPENR: Expression must be named variable in this context: <INT
> ( 1)>.
>
Hi,
In addition to the solution Maarten points to, check out the language
of the error...
"Expression must be named variable in this context"
It is the "named variable" part that indicates you must provide a
variable to which the routine will assign a value.
This is the kind of language you'll see pop up in IDL's reference docs
all the time.
Cheers,
Ben
|
|
|
Re: File unit problems [message #56560 is a reply to message #56559] |
Mon, 29 October 2007 03:10  |
Liberum
Messages: 48 Registered: September 2005
|
Member |
|
|
On 29 Okt, 11:02, Maarten <maarten.sn...@knmi.nl> wrote:
> On Oct 29, 8:08 am, Sheldon <shejo...@gmail.com> wrote:
>
>> Hi!
>
>> I am having some trouble with the file unit in IDL. I have included
>> the part of code that the error occurrs.
>> I think this is something quite simple but I don't get it. Can someone
>> please point out the problem for me?
>
> Make yourself happy, and let IDL figure uot which unit numbers to use.
> you cannot combine /get_lun with a hard-coded number.
>
> openr, land_lut_unit, land_lut, /get_lun
> openw, out_unit, "land_scat_clas_tuned.dat", /GET_LUN
>
> close the units again with
> free_lun, land_lut_unit, out_unit
>
> HTH,
>
> Maarten
Thanks!
It works. Will follow this rule hence forth!
/S
|
|
|
Re: File unit problems [message #56561 is a reply to message #56560] |
Mon, 29 October 2007 03:02  |
Maarten[1]
Messages: 176 Registered: November 2005
|
Senior Member |
|
|
On Oct 29, 8:08 am, Sheldon <shejo...@gmail.com> wrote:
> Hi!
>
> I am having some trouble with the file unit in IDL. I have included
> the part of code that the error occurrs.
> I think this is something quite simple but I don't get it. Can someone
> please point out the problem for me?
Make yourself happy, and let IDL figure uot which unit numbers to use.
you cannot combine /get_lun with a hard-coded number.
openr, land_lut_unit, land_lut, /get_lun
openw, out_unit, "land_scat_clas_tuned.dat", /GET_LUN
close the units again with
free_lun, land_lut_unit, out_unit
HTH,
Maarten
|
|
|