NCL

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
jivica
Posts: 137
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

NCL

#1 Post by jivica » Tue Mar 04, 2008 4:17 pm

Dear users,
I am thinking to move on NCL to get ROMS figures instead of Matlab
so I am collecting scripts .ncl for vecplots and other fields..
If you are willing to share you'll save me a lot of time
Thanks in advance!
Cheers, Ivica

User avatar
arango
Site Admin
Posts: 1129
Joined: Wed Feb 26, 2003 4:41 pm
Location: IMCS, Rutgers University
Contact:

#2 Post by arango » Tue Mar 04, 2008 6:44 pm

Plotting is a matter of taste. I personally stay away from plotting software that does not have vector graphics in their core. However, I do use Matlab as a scientific tool but it takes a lot of skill and experience to produce high quality plots for publications. In publications, we usually need to reduce the size of the plots which affects lines, labels, and text fonts. Post-processing software (CorelDraw, Adobe, etc) is required to edit the plot. Reducing or enlarging raster plots gives unsatisfactory results. This is not a problem in vector graphics.

ROMS output is CF compliant so any NetCDF browser tool can be used to plot. The quality of plots is not that great for publications but good enough to examine your results. Some of these browsers plot the vertical terrain-following coordinates correctly because of the CF compliant attributes:

Code: Select all

        double s_rho(s_rho) ;
                s_rho:long_name = "S-coordinate at RHO-points" ;
                s_rho:valid_min = -1. ;
                s_rho:valid_max = 0. ;
                s_rho:standard_name = "ocean_s_coordinate" ;
                s_rho:formula_terms = "s: s_rho eta: zeta depth: h a: theta_s b: theta_b depth_c: hc" ;

        double s_w(s_w) ;
                s_w:long_name = "S-coordinate at W-points" ;
                s_w:valid_min = -1. ;
                s_w:valid_max = 0. ;
                s_w:standard_name = "ocean_s_coordinate" ;
                s_w:formula_terms = "s: s_w eta: zeta depth: h a: theta_s b: theta_b depth_c: hc" ;
ROMS also has its own :arrow: plotting package which it is in the svn repository. This plotting package has been developed over the last 15 years. It is quite complex but easy to use. It is a collection of F77 routines that use :arrow: NCAR's GKS plotting library which is now part of NCL. Kate has mentioned in the past her desire to use the NCL capability of the NCAR package to plot ROMS results. The resulting plots are vector. The text labels are also vector but it can use some improvement.

We added a lot information in WikiROMS about the ROMS :arrow: plotting package. It is easy to install, use, and it is free :idea: .

User avatar
jivica
Posts: 137
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

#3 Post by jivica » Wed Mar 05, 2008 7:21 am

Thanks for the reply,
I have installed week ago :wink: , plotting stuff from roms svn, I am using it but seems to me it's easier to use scripts like .ncl where one can change more options like res@ and so on on the fly...
At think that on the wiki you should put ncargwww and ncarg2gif commented that It can be used with Image magic convert (have more/less every linux machine) and that there is no need to install imtools (which I could not on linux machine).... putting some example .in file for doing vectors would help and attract more people to use it.. I do need this stuff for batch script run by crontab without DISPLAY, and not fooling matlab with vncserver and all other dirty techniques in order to get .gif or .png for web....
Sure, for publications I use matlab, for fast preview of like frc fields ncview and so on.. .NCL seems more mature in nowdays than it was before...
I was hopping that Kate is having collection of .ncl scripts, know she is doing a lot with ncl ....

Cheers, Ivica

User avatar
arango
Site Admin
Posts: 1129
Joined: Wed Feb 26, 2003 4:41 pm
Location: IMCS, Rutgers University
Contact:

#4 Post by arango » Wed Mar 05, 2008 4:07 pm

We do this all the time. Notice that any of the plotting input files cnt.in, ccnt.in, sec.in, and csec.in can be put in scripts. Check the following script plot/src/Bin/plt_html.sh to see how this is done. This script was used to generate the following :arrow: images.

We have used similar scripts to generate hundreds of plots automatically. Mostly all the plots in the Applications menu of the ROMS website use such scripts. For example, check the forecast experiments in the :arrow: Philippine Archipelago and :arrow: Intra-Americas Sea. We have a single script that process input data, run the model, assimilate data, and send the plots to the website. Of course, some experience is required to write all these scripts. Pretty neat, ha?

We have also done animations with such scripts.

Yes, we have versions of ncargwww and ncar2gif for Linux computers which uses convert instead of imconv. These scripts are well documented and easy to follow. I will load a newer ncarg2gif to the svn repository. I missed that one.

User avatar
kate
Posts: 3800
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

#5 Post by kate » Thu Mar 06, 2008 6:17 pm

There are a couple scripts in http://people.arsc.edu/~kate/NCL/

roms_sst.ncl plots SST with the correct map - it was written by one of the NCL folks at NCAR and is very close to the ROMS example on their site. Change gsn_csm_contour_map to gsn_csm_contour for square box coordinates. stations.ncl is for plotting stations. I'm afraid we don't yet have the full functionality of Hernan's plotting package, though I think there is a set_depth code around somewhere too.

User avatar
jivica
Posts: 137
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

#6 Post by jivica » Fri Mar 07, 2008 8:49 pm

Thanks Kate;
I find Hernan's ploting stuff very usefull and have installed it without a problem. More over, I would like to change vector's color and so on, play little bit with contour @res and other options, add something and put it to run via cron (without DISPLAY which matlab req.).. so I think .ncl are usefull as well, hoping that one have made vector plot via .ncl by reinteroplating at rho points or using 1/2 offset...
Cheers, Ivica

jacopo
Posts: 81
Joined: Fri Nov 21, 2003 9:30 pm
Location: CNR-ISMAR

#7 Post by jacopo » Tue Mar 11, 2008 9:47 am

For those of you which are struggling with Matlab plotting without a display, there is a way to by-pass this.

If you print the plots in *.ps with -cymk -painters options, it works even without a display.

Then you can convert your *.ps in whatever format you want outside Matlab (I personally use mogrify from ImageMagick in LINUX).

User avatar
jivica
Posts: 137
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

model time

#8 Post by jivica » Fri Mar 14, 2008 11:35 am

I have problem using plotting package when I use TIMEREF=-2,
so I have offset of datenum(1968,23,5) which is state in @units and not in the add_offset ....
Should I change opencdf.F where are attributes checked to get right offset?
Thanks
Ivica

User avatar
jivica
Posts: 137
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

#9 Post by jivica » Fri Mar 14, 2008 12:08 pm

Or just simply specify startdate in the first line of .in file (second variable) for ccnt?

User avatar
arango
Site Admin
Posts: 1129
Joined: Wed Feb 26, 2003 4:41 pm
Location: IMCS, Rutgers University
Contact:

#10 Post by arango » Fri Mar 14, 2008 4:53 pm

You don't need to change any code. The plotting program will figure out internally that your time coordinates are modified Julian day numbers. The year and starting year-day in the plotting input scripts will be ignored. You can set it:

Code: Select all

2008  0  :  year and starting year-day (use yearday<0, for no time label)
and the plotting programs will give you the correct date in the plot label. Notice that you can still plot if you do

Code: Select all

2008 -1  :  year and starting year-day (use yearday<0, for no time label)
but not time dates will be used in the label.

Also, try

Code: Select all

0     FRSTD  : first day to plot
0     LASTD  : last day to plot
0     DSKIP  : plot every other DSKIP days (0.0 plot at its own time frequency)
to see what dyou get. You can manipulate all these parameters to junk for a specific day to plot.

Post Reply