Re: Using Resource Files: ncl.res and name.res

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Jun 16 2010 - 07:53:42 MDT

Hi Alvaro,

I'm not sure why "ncl.res" is mentioned, because I just tried this and
it didn't work for me.
I'll see about getting the documentation corrected.

Meanwhile, I'll try to explain the various ways you can use resource
files. After
writing this, I'm realizing how complicated it seems:

1. The "simplest" way is when you call:

    wks = gsn_open_wks("ps","xyz")

If you have a "xyz.res" file, then NCL will use it when you run this
script.

This won't help you much, since you are dealing with multiple scripts,
and
probably don't want to have all of them writing to "xyz.ps".

2. Another way to use a resource file, that we recommend for *every*
user is to
have a ".hluresfile" in your home directory. This file will be used
any time you
run NCL on that machine. For more information, see:

http://www.ncl.ucar.edu/Document/Graphics/hlures.shtml

Again, this may not apply for you, if you are trying to set a block of
resources
that only apply to *some* scripts.

3. A third way, which may be closer in line to how you want to do it,
is to set up
a system application resource file. The default location for this is
$NCARG_ROOT/lib/ncarg/sysappres, but you can override this by setting
the environment variable NCARG_SYSAPPRES to the directory
of the resource file you want to use.

The problem with this is you need to use the same prefix name as
what you use for the second argument to gsn_open_wks:

For example, let's say your directory is /home/alvaro/scripts, and you
have called:

    wks = gsn_open_wks("x11","test2")

Then you can do this:

   setenv NCARG_SYSAPPRES /home/alvaro/scripts

and make sure you have a "test2.res" file in the above directory.

This method allows you to use different arguments for the second
argument
in gsn_open_wks, but you will need a different resource for each.

If you don't like the idea of having to set an environment variable or
being
limited to the same name as the gsn_open_wks name, then
you can programmatically set the location of an application resource
file,
but you will have to replace "gsn_open_wks" with more complicated code:

   appid = create "xyz" appClass defaultapp
     "appSysDir" : "/Users/haley" ; Indicate directory location of
application resource file, "xyz.res"
   end create

   wks = create "postscript" psWorkstationClass appid
     "wkPSFileName" : "test.ps"
   end create

The above will look for a resource file /Users/haley/xyz.res (it uses
the name given to the "appClass"),
and will create a PostScript file called "test.ps".

The above allows you to just have one resource file in one location,
and then you can change your
workstation code appropriately to write to a different file name (the
"wkPSFileName" resource).

4. There's a fourth way to set a resource file, which applies to
*anybody* running NCL on a particular
system. This is the system resource file, which defaults to
$NCARG_ROOT/lib/sysresfile. You
can use NCARG_SYSRESFILE to change the location of this.

There's more information at:

http://www.ncl.ucar.edu/Document/HLUs/User_Guide/hluimplmt/rescfiles.shtml

--Mary

On Jun 16, 2010, at 3:13 AM, Álvaro M. Valdebenito B. wrote:

> Hi,
>
> I am looking for information about how to set the default resources
> for
> all scripts on a given directory.
>
> According to
> http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclGraphics.shtml#resources
> I should be able to do this by writing the defaults on a file named
> "ncl.res" and place it on the directory from were I run ncl.
> Well, I have tired this, and it does not work...
>
> According to
> http://www.ncl.ucar.edu/Document/HLUs/User_Guide/hluimplmt/rescfiles.shtml
> I can set a Users Application Specific Resource file ("name.res").
> Here I can only guess that "name.res" is actually
> "name_of_the_application.res", and that it should be located in the
> same
> directory as the application, or in the directory from were I run ncl.
> None of these options have work either.
>
> I have searched the website for additional information, without much
> success.
>
> What am I missing?
> Is there more info elsewhere?
>
> Thanks in advance,
> Alvaro.
>
> --
> Álvaro M. Valdebenito B., Dr. rer. nat.
> alvaro.valdebenito@met.no
> Air Pollution Section/Research Department Tel. +47-2296 3397
> Norwegian Meteorological Institute http:\\www.met.no
> P.O. Box 43 Blindern, 0313 Oslo, NORWAY http:\\www.emep.int/CWF
> _______________________________________________
> 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 Jun 16 07:53:48 2010

This archive was generated by hypermail 2.1.8 : Wed Jun 16 2010 - 15:28:33 MDT