[Thread Prev][Thread Next][Index]

Re: [ferret_users] how to refer to multiple identical filenames inFerret



Hi Billy,
          Yes, that is a good solution. A similar trick for reading 
binary datasets is explained in user manual Ch2 Sec6. For beginners,
this may be a good starting point.

   Billy, I also work on mom4 outputs and the method i found very
convenient is "descriptor" files. As you explained, in my case also
the filenames are same between experiments but directory names will 
be different, according to the model experiment. I used to keep a 
directory in the name "analysis" in my home area, where the descriptor
files are kept according to the experiment name as follows :

  /home/jaison/analysis/  control_temp.des
                          control_salt.des
                          turb_temp.des
                          turb_salt.des .... etc

So I don't have to worry about where exactly is my output files are
located or in Ferret d=1 corresponds to which experiment. After using
this descriptor files with full path for 2-3 times, comparing the 
experiments or switching between experiments in a Ferret session is 
really cool....Even if there is only one NetCDF file from the model run,
this method is safer i think. Once a proper descriptor file is made
and placed in ~/analysis, i can comfortably use it in Ferret without
any problem.

     This method is a big relief if your model outputs are saved in 
multiple NetCDF files. There is no need to fear about accidental
removal of original data files. You will not fill up your working 
directory with symbolic links. 
 
Cheers....

Jaison


On Sun, 10 Dec 2006, William S. Kessler wrote:

> Hi all -
> 
> This is an answer rather than a question. Maybe this is obvious to  
> some, but it wasn't to me ....
> 
> When an OGCM is run repeatedly with different forcing, you may end up  
> with identical filenames in different directories. For example I run  
> MOM4 with various forcing anomalies, and the filenames describe the  
> date of each snapshot, while the directories they are in describe the  
> model run. For example I have files:
> 
> /data/Models/mom4/seasonal_cycle/ocean_day_2002_10_05.nc		! a  
> seasonal cycle run
> /data/Models/mom4/EXP_1003/ocean_day_2002_10_05.nc			! a run with  
> modified winds
> 
> If typing in commands by hand, I can easily do operations on the  
> files, for example:
> 
> yes? shade/z=0 temp[d=2] - temp[d=1]		! plot anomaly of SST
> 
> But suppose I want to do this in a script that would open the two  
> files and do the comparison. Then I can't assume that the datasets  
> are 1 and 2. Nor can I use the filename to distinguish them, since  
> they are identical.
> 
> You can do this in a script using unix soft links. Here's an example  
> script to do this:
> ---------------------------------------------------
> ! $1=experiment number (e.g. 1003)
> ! $2,3,4=yr,mon,day (e.g. 2002 10 05)
> ! $5=depth level
> 
> ! use the input values to construct the filename
> def sym fname "ocean_day_$2_$3_$4"
> 
> ! use soft links to define temporary names for these files
> ! ==>> must be soft links (ln -s)!! Else will delete the actual file!  
> <<==
> ! first get rid of previous definitions
> can dat/noerr seasonal
> can dat/noerr anomalies
> sp \rm seasonal.nc
> sp \rm anomalies.nc
> sp ln -s /data/Models/mom4/EXP_$1/($fname).nc anomalies.nc
> sp ln -s /data/Models/mom4/seasonal_cycle/($fname).nc seasonal.nc
> 
> ! bring in and use the identical filenames under new descriptive names
> use seasonal.nc
> use anomalies.nc
> 
> shade/z=$5 temp[d=anomalies] - temp[d=seasonal]
> ---------------------------------------------------
> 
> Billy K
> 

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement