Re: [thredds] nco as a web service

On Jul 1, 2012, at 11:25 AM, Dennis Heimbigner wrote:

> Roy-
> > ...  One comment.  I think you misunderstood my point about
> > Matlab and R.  I am not interested in Matlab specific
> > implementations.  The point was because the URL completely
> > defines the request, I can implement scripts in any application
> > that can send an URL and receive a file in terms of functions
> > built-in to that application - that is my clients do not break as
> > the application or operating system change.
> Not quite sure I understand. This phrase "...receive a file in
> terms of functions built-in to that application" sounds
> like you are creating an association between functions defined
> on the client side and functions defined on the server side.
> Can you elaborate?

Okay, let's start with my original example.  Put the following URL in your 

You just downloaded a netcdf file that was a subset of a larger virtual file.  
And try this one:[(2010-01-16T12:00:00Z):1:(2010-01-16T12:00:00Z)][(0.0):1:(0.0)][(30):1:(50.0)][(220):1:(240.0)]

You just got a png of the same data.  These URL's completely define the service 
request, in this case the service is ERDDAP.  So given that, any application 
that has a command that can send an URL and receive a file, can use the 
service.  In the case of Matlab that command is "urlwrite".  In case of R, that 
command is "download.file".  So now we can develop scripts for Matlab and R 
that are based on the commands "urlwrite" or "download.file", can use the 
service by just constructing the proper URL, and therefore every command in the 
script is a command built into that application, so the updating and 
maintenance of that command is the job of the application developer.

Just to either make the point clearer or to muddy the waters  (you never know), 
here is a brief matlab script that uses the command  (it does use the m_map 
toolbox for mapping but that is separate from the service):

> link='[(2010-01-16T12:00:00Z):1:(2010-01-16T12:00:00Z)][(0.0):1:(0.0)][(30):1:(50.0)][(220):1:(240.0)]';
> F=urlwrite(link,'cwatch.mat');
> load('-MAT',F);ssta=reshape(erdBAsstamday.sst,201,201);
> pcolor(double(ssta));shading flat;colorbar;
> latitude= erdBAsstamday.latitude;
> longitude= erdBAsstamday.longitude;
> [Plg,Plt]=meshgrid(longitude,latitude);
> m_proj('mercator','lon',[-140 -115], 'lat', [30 50]);
> m_pcolor(Plg-360,Plt,double(ssta));
> shading flat;
> m_coast('patch',[.7 .7 .7]);
> m_grid;
> colorbar;

And similarly in R:

> library(ncdf4)
> library(lattice)
> download.file(url="[(2010-01-16T12:00:00Z):1:(2010-01-16T12:00:00Z)][(0.0):1:(0.0)][(30):1:(50.0)][(220):1:(240.0)]",
>  destfile="",mode='wb')
> AGsstaFile<-nc_open('')
> sst<-ncvar_get(AGsstaFile,'sst',start=c(1,1,1,1),count=c(-1,-1,-1,-1))
> lonval<-ncvar_get(AGsstaFile,'longitude',1,-1)
> latval<-ncvar_get(AGsstaFile,'latitude',1,-1)
> image(lonval,latval,sst,col=rainbow(30))

To see this idea taken to a further level, see


"The contents of this message do not reflect any position of the U.S. 
Government or NOAA."
Roy Mendelssohn
Supervisory Operations Research Analyst
Environmental Research Division
Southwest Fisheries Science Center
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097

e-mail: Roy.Mendelssohn@xxxxxxxx (Note new e-mail address)
voice: (831)-648-9029
fax: (831)-648-8440

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected" 
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.

  • 2012 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the thredds archives: