[Thread Prev][Thread Next][Index]

Re: Fwd: [ferret_users] multiple legend



Hello Saat,
G'day
The easiest way to install pyferret is from Anaconda cloud (https://www.anaconda.com/distribution/).
First you have to install anaconda I would recommend you to go for python 3.7 for LINUX.

This will guide you how to install anaconda in linux. (https://docs.anaconda.com/anaconda/install/linux/) or (https://www.digitalocean.com/community/tutorials/how-to-install-anaconda-on-ubuntu-18-04-quickstart) etc.....

After installing ANACONDA you can easily install pyferret from it by these steps. Important thing is to create an new environment for pyferret (I created FERRET). This is because your linux is having its base environment which is not up to date on repository to install software e.g. CDO, FERRET, NCL etc.
Here is the command to install pyferret from ANACONDA cloud.

conda create -n FERRET -c conda-forge pyferret ferret_datasets --yes

In this command conda create is creating an environment named as FERRET (you can give any other name also like ferret7 etc.).

after running this command conda (Anaconda) will start and complete the installation for you under the environment name FERRET. Now close the terminal and open a new one  and type.

conda info --envs (this command will show you the environments in your linux system, I have 4 environment for each software I use)
# conda environments:
#
base                  *  /home/srathore/anaconda3
FERRET               /home/srathore/anaconda3/envs/FERRET
NCL                      /home/srathore/anaconda3/envs/NCL
POP                     /home/srathore/anaconda3/envs/POP

the Base is the basic environment of linux. it comes when you install linux. So right now I am in my base environment which is shown by asterisk sign (*) and your terminal will show like this (base) user@user-Latitude-E7470:~$.

Now you want to use Pyferret so you have to go in that environment and start using pyferret from there. Here is the command to activate the FERRET environment.

conda activate FERRET

now you are in FERRET environment so you can start using pyferret. After issuing this command your terminal will show like this (FERRET) user@user-Latitude-E7470:~$.This shows that your base environment is now changed to FERRET environment.

If you now issue the command (conda info --envs) to check the environment, it will appear like this (e.g. on my linux system)

# conda environments:
#
base                     /home/srathore/anaconda3
FERRET             * /home/srathore/anaconda3/envs/FERRET
NCL                      /home/srathore/anaconda3/envs/NCL
POP                     /home/srathore/anaconda3/envs/POP

the asterisk (*) is now shifted to FERRET environment from base environment.

Now lets suppose you want to deactivate the environment you are in currently. So simply type conda deactivate this will bring you back into base environment.

Similarly if you want to install CDO

This will show you how to install anaconda and CDO (https://code.mpimet.mpg.de/projects/cdo/wiki/Anaconda). I already gave you the link on how to install anaconda so after installing anaconda no need to repeat the step again mentione don CDO page. So just move to
conda config --add channels conda-forge

conda install cdo

Similarly you can find the cdo installation on t his link also (https://anaconda.org/conda-forge/cdo).

We hope this might help you to install many open source software quickly and easily.

Cheers, Saurabh

On Fri, Aug 9, 2019 at 6:37 AM Ansley C. Manke <ansley.b.manke@xxxxxxxx> wrote:

Hi,

I see in your original message that you are running Ferret v6.64.  PLOT/KEY=title was introduced after that version.  If you can, please update your Ferret executable, or even better, install PyFerret.

-Ansley

On 8/7/2019 5:19 PM, Saat Mubarrok wrote:


---------- Forwarded message ---------
From: Saat Mubarrok <saatmubarrok@xxxxxxxxx>
Date: Thu, Aug 8, 2019 at 9:18 AM
Subject: Re: [ferret_users] multiple legend
To: Ansley C. Manke <ansley.b.manke@xxxxxxxx>


Dear Mrs. Ansley,

Thank you for your answer. I tried the example you gave but it has error, the key/title is unknown
 command qualifier. And after I deleted it, the figure showed up but all lines were black.
Is the command only apply for new ferret version? Mine is 6.64.

Best regards,
Saat M.

On Wed, Aug 7, 2019 at 1:52 AM Ansley C. Manke <ansley.b.manke@xxxxxxxx> wrote:

Hi,

The command qualifier PLOT/KEY=title will use the titles from the variables in the legend of a line plot. Try this example

yes? let/title="Line one" _one_ =  3*X+2
yes? let/title= "Line Two" two = X - 1.5
yes? let/title = "Line Three" three =  4*X+3
yes? plot/color/key=title/x=1:100 one, two, three

(I also used PLOT/COLOR there.  This is a fairly recent addition; PLOT/COLOR with no argument will skip black as a color and start with the colored lines.)

For your script, the problem is that you can't nest grave-accent expressions, but you can have a symbol evaluation inside a grave-accent _expression_. Something along these lines should work:

!MAIN: PLOTTING (2)
plot/thick= 1/vlim=25:31:0.2 /color=19 a19
repeat/name=mn/range=1:18 (\
plot/over/thick=1/vlim=25:31:0.2/symbol=`mn`/line=`mn` a`mn`;\
define symbol mn= `mn`;\
go legend `mn` "`a($mn),return=title`" ur;\
ppl plot;\
)

There is yet another option, a new script linekey.jnl, which was just added and is not yet in the PyFerret/Ferret releases. It was mentioned here, https://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2019/msg00183.html. I have attached linekey.jnl and test_linekey.jnl which is a demo script that calls it.  This lets you put the legend inside the plot box or outside its edges, and gives control over symbols used in the line samples.

Ansley

On 8/5/2019 6:51 PM, Saat Mubarrok wrote:
Dear community,

I was trying to plot multiple line for seasonal variation from 19 models from different data sets.
But the problem is I cannot put the legend using legend.jnl. I was trying to use two option based on FAQ and resource from internet:

...
!MAIN:CALCULATE SEASONAL VARIATION
repeat/name=mm/range=1:19 (\
let modelid=model[i=`mm`];\
let/title="`modelid`" a`mm`=thetao_sst[d=`mm`,y=5s:10s@ave,x=50e:80e@ave, z=1, gt=month_reg@mod];\
)

!MAIN:PLOTTING (1)
plot/thick=1/vlim=25:31:0.2 a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19;\
....

The problem from script above is the legend placed at below the figure and the name of each line is not the model name (modelid) but variable `a1,a2,a3..` instead. I want to put the legend in upper right of figure.
...
!MAIN: PLOTTING (2)
plot/thick= 1/vlim=25:31:0.2 /color=19 a19
repeat/name=mn/range=1:18 (\
plot/over/thick=1/vlim=25:31:0.2/symbol=`mn`/line=`mn` a`mn`;\
go legend `mn` "`a`mn`,return=title`" ur;\
ppl plot;\
)
...

The problem is that:
**ERROR: variable unknown or not in data set: A
go legend 1 "`a`mn`,return=title`" ur
Command file, command group, or REPEAT execution aborted

So my purpose is to put the legend in upper right part and has a model name on it.
Because I am new to ferret, so any other help, lead, and suggestion is much appreciate.
Thank you very much.

NOAA/PMEL TMAP
  FERRET v6.64  
  Linux(gfortran) 2.6.9-89.0.20.ELsmp - 09/16/10
  6-Aug-19 10:50


Saat M.
KIOST



--
Ansley Manke
NOAA/PMEL Science Data Integration Group
7600 Sand Point Way NE
206-526-6246
--
Ansley Manke
NOAA/PMEL Science Data Integration Group
7600 Sand Point Way NE
206-526-6246


--


REGARDS

Saurabh Rathore
Research Scholar (PhD.)
Centre For Oceans, Rivers, Atmosphere & Land Science Technology
Indian Institute Of Technology, Kharagpur
contact :- 91- 8345984434

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement