source: trunk/UTIL/NCL/visu-ncl @ 498

Last change on this file since 498 was 497, checked in by slebonnois, 14 years ago

Ajout de scripts NCL dans UTIL. Pas encore tres developpe mais dites moi ce que vous en pensez. + correction bug pour marees grav Titan dans leapfrog

File size: 4.7 KB
Line 
1#!/bin/bash
2
3# Directory where the NCL files are located ** EDIT **
4
5export NCLDIR=~/LMDZ5/UTIL/NCL
6
7########################################################################
8# Mise en place des valeurs par defaut
9########################################################################
10
11inFile="nofile"
12var="liste"
13var2="dummy"
14media="x11"
15outputname="quickview"
16typeplot="coupe"
17ntcutmin=0
18ntcutmax=$ntcutmin
19tavg=-999
20pcutmin=1.e4
21pcutmax=$pcutmin
22pavg=-999
23lcutmin=0
24lcutmax=$lcutmin
25lavg=-999
26Lcutmin=0
27Lcutmax=$Lcutmin
28Lavg=-999
29# (if limits are identical, average need to be made to trim the dimension)
30
31# -888 => default variable chosen by NCL
32valmin=-888
33valmax=-888
34step=-888
35valmin2=-888
36valmax2=-888
37step2=-888
38
39Lcenter=0
40lcenter=40
41grid="True"
42gLspc=30
43glspc=20
44gcol="white"
45
46########################################################################
47# lecture des options
48########################################################################
49
50while (($# > 0))
51  do
52  case $1 in
53      "-h") cat $NCLDIR/help.txt
54          exit;;
55      "-f")
56          inFile=$2 ; shift ; shift ;;
57      "-v")
58          var=$2 ; shift ; shift ;;
59      "-v2")
60          var2=$2 ; shift ; shift ;;
61      "-med")
62          media=$2 ; shift ; shift ;;
63      "-oname")
64          outputname=$2 ; shift ; shift ;;
65      "-type")
66          typeplot=$2
67          if [ $typeplot = "stereo" ]; then
68            lcenter=90
69          fi
70          shift ; shift ;;
71      "-tc")
72          ntcutmin=${2%%,*}
73          tmp=${2#*,}
74          ntcutmax=${tmp%%,*}
75          if [ $ntcutmin = $ntcutmax ]; then
76            tavg=-999
77          else
78            tavg=${tmp#*,}
79          fi
80          shift ; shift ;;
81      "-pc")
82          pcutmin=${2%%,*}
83          tmp=${2#*,}
84          pcutmax=${tmp%%,*}
85          if [ $pcutmin = $pcutmax ]; then
86            pavg=-999
87          else
88            pavg=${tmp#*,}
89          fi
90          shift ; shift ;;
91      "-lc")
92          lcutmin=${2%%,*}
93          tmp=${2#*,}
94          lcutmax=${tmp%%,*}
95          if [ $lcutmin = $lcutmax ]; then
96            lavg=-999
97          else
98            lavg=${tmp#*,}
99          fi
100          shift ; shift ;;
101      "-Lc")
102          Lcutmin=${2%%,*}
103          tmp=${2#*,}
104          Lcutmax=${tmp%%,*}
105          if [ $Lcutmin = $Lcutmax ]; then
106            Lavg=-999
107          else
108            Lavg=${tmp#*,}
109          fi
110          shift ; shift ;;
111       "-lim")
112          valmin=${2%%,*}
113          tmp=${2#*,}
114          valmax=${tmp%%,*}
115          if [ $valmin = $valmax ]; then
116          # si pas les deux, remises au default
117             valmin=-888
118             valmax=-888
119          else
120            step=${tmp#*,}
121          fi
122          if [ $step = $valmax ]; then
123          # si pas de step, il est remis au default
124             step=-888
125          fi
126          shift ; shift ;;
127       "-lim2")
128          valmin2=${2%%,*}
129          tmp=${2#*,}
130          valmax2=${tmp%%,*}
131          if [ $valmin2 = $valmax2 ]; then
132          # si pas les deux, remises au default
133             valmin2=-888
134             valmax2=-888
135          else
136            step2=${tmp#*,}
137          fi
138          if [ $step2 = $valmax2 ]; then
139          # si pas de step, il est remis au default
140             step2=-888
141          fi
142          shift ; shift ;;
143       "-center")
144          Lcenter=${2%%,*}
145          tmp=${2#*,}
146          lcenter=${tmp%%,*}
147          shift ; shift ;;
148       "-grid")
149          if [ $2 = "T" -o $2 = "y" -o $2 = "Y" ]; then
150            grid="True"
151          fi
152          if [ $2 = "F" -o $2 = "n" -o $2 = "N" ]; then
153            grid="False"
154          fi
155          shift ; shift ;;
156      "-gcol")
157          gcol=$2 ; shift ; shift ;;
158       "-gspc")
159          gLspc=${2%%,*}
160          tmp=${2#*,}
161          glspc=${tmp%%,*}
162          shift ; shift ;;
163  esac
164done
165
166###############################################################
167if [ $inFile = "nofile" ]; then
168        echo "You have to specify a file ! ( -f filename )"; exit
169fi 
170
171if [ -f $inFile ]; then
172        echo "File "$inFile" exists"
173else 
174        echo "File "$inFile" does not exists"; exit
175fi 
176
177if [ $typeplot = "ortho" ]; then
178    # lat and lon put to 2d, defaulting to full map in planeto.ncl
179        lcutmin=-90
180        lcutmax=90
181        lavg=0
182        Lcutmin=0
183        Lcutmax=180
184        Lavg=0
185fi 
186
187export SIMUDIR=`pwd`
188inFile=$SIMUDIR/$inFile
189cd $NCLDIR
190ncl inFile=\"$inFile\"  \
191    var=\"$var\" \
192    var2=\"$var2\" \
193    media=\"$media\" \
194    outputname=\"$outputname\" \
195    typeplot=\"$typeplot\" \
196    ntcutmin=$ntcutmin \
197    ntcutmax=$ntcutmax \
198    tavg=$tavg \
199    pcutmin=$pcutmin \
200    pcutmax=$pcutmax \
201    pavg=$pavg \
202    lcutmin=$lcutmin \
203    lcutmax=$lcutmax \
204    lavg=$lavg \
205    Lcutmin=$Lcutmin \
206    Lcutmax=$Lcutmax \
207    Lavg=$Lavg \
208    valmin=$valmin \
209    valmax=$valmax \
210    step=$step \
211    valmin2=$valmin2 \
212    valmax2=$valmax2 \
213    step2=$step2 \
214    Lcenter=$Lcenter \
215    lcenter=$lcenter \
216    grid=$grid \
217    gLspc=$gLspc \
218    glspc=$glspc \
219    gcol=\"$gcol\" \
220    planeto.ncl
221
Note: See TracBrowser for help on using the repository browser.