NCL

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

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

NCL

#1 Unread post by jivica »

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: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

#2 Unread post by arango »

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: 172
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia
Contact:

#3 Unread post by jivica »

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: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

#4 Unread post by arango »

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: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

#5 Unread post by kate »

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: 172
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia
Contact:

#6 Unread post by jivica »

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 Unread post by jacopo »

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: 172
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia
Contact:

model time

#8 Unread post by jivica »

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: 172
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia
Contact:

#9 Unread post by jivica »

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

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

#10 Unread post by arango »

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.

agpc
Posts: 63
Joined: Mon Jul 27, 2020 7:44 pm
Location: Applied Geophysics Center (AGPC)

Re: NCL

#11 Unread post by agpc »

Hi Kate,
Can you kindly give my your NCL scripts to plot the output of the ROMS model.
I can not to connect to the link "http://people.arsc.edu/~kate/NCL/"
Here is my email address "ntmanh18196@gmail.com".
Thank you very much!
Bests,
Manh,

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

Re: NCL

#12 Unread post by kate »

This is not the time to start learning NCL. Support for NCL development has been dropped and the focus is now on developing Python tools instead.

While we have some plotting capability in pyroms, it too is now out of date, what with the rapid development in new Python tools. I am hardly the expert on this stuff any more.

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

Re: NCL

#13 Unread post by jivica »

If you really want to stick to NCL, still you can.
Getting on the NCL web site and going on Models/ROMS:
https://www.ncl.ucar.edu/Applications/roms.shtml
You can have basic scripts (and roms_utils.ncl) that Kate and myself contributed long time ago.

PyNGL is advertised as future development of NCL and it is quite easy to step forward (even if you don't want to use other python tools).
I am using pyNGL in my operational setup and developed whole suite around it to produce automatic plots etc...

Ivica

agpc
Posts: 63
Joined: Mon Jul 27, 2020 7:44 pm
Location: Applied Geophysics Center (AGPC)

Re: NCL

#14 Unread post by agpc »

Dear Ivica,
Can you kindly give me some scripts to plot the output of the ROMS model.
I've tried to compile the plotting package of ROMS but it still failed.
Thank you very much!
Best regards,
Manh

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

Re: NCL

#15 Unread post by jivica »

Just click on the link I've sent you in the previous email?!

agpc
Posts: 63
Joined: Mon Jul 27, 2020 7:44 pm
Location: Applied Geophysics Center (AGPC)

Re: NCL

#16 Unread post by agpc »

Hi Ivica,
I mean that can you give your scripts on pyNGL?
Besides, I don't have the CGOA_grid_3.nc file to know what exactly in this file.
Thank you very much!
Bests,

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

Re: NCL

#17 Unread post by jivica »

Mate,

you should familiarize with ROMS and python if you want to use pyNGL (and on top of that some knowledge of NCL would help).

My scripts, as I wrote you before, are elaborated version with multi model config files etc. and are not easily transferable to your (or any) system without effort.

For example, operational systems https://oceangliders.ecm.uwa.edu.au/Model/model.php is using pyNGL engine to plot ROMS and WRF model outputs, similar in http://bora.gekom.hr/ but on top of that unstructured waves.

You can use any pyNGL example (from the web page, do the homework), load in python any ROMS field and then do NGL.contour or vecotr or whatever you want (even overlays). There is no silver bullet that will do all for you.

Good luck,
I

Post Reply