Presentation is loading. Please wait.

Presentation is loading. Please wait.

DKRZ and M&D Introduction course 2006 Diagnostic & Visualisation Introduction Diagnostic cdo Visualisation gnuplot GrADS GMT cdat.

Similar presentations


Presentation on theme: "DKRZ and M&D Introduction course 2006 Diagnostic & Visualisation Introduction Diagnostic cdo Visualisation gnuplot GrADS GMT cdat."— Presentation transcript:

1 DKRZ and M&D Introduction course 2006 Diagnostic & Visualisation Introduction Diagnostic cdo Visualisation gnuplot GrADS GMT cdat

2 DKRZ and M&D Introduction course 2006 fetching data from data base Ferretncaridl gnuplot 2 GrADS 3 gmt 4 cdat 5 diagnostic cdo 1 graphic tools

3 DKRZ and M&D Introduction course 2006 Introduction Diagnostic cdos info change formats extract regions extract time slices interpolate grids build means, mins, maxs change values prepare for visualisation Visualisation gnuplot GrADS GMT cdat

4 DKRZ and M&D Introduction course 2006 CDO There are more than 250 operators available. File information (info, sinfo, diff,...) File operations (copy, cat, merge, split,...) Selection (selcode, selvar, sellevel, seltimestep,...) Missing values (setctomiss, setmisstoc, setrtomiss) Arithmetic (add, sub, mul, div,...) Mathematical functions (sqrt, exp, log, sin, cos,...) Comparision (eq, ne, le, lt, ge, gt,...) Conditions (ifthen, ifnotthen, ifthenc, ifnotthenc) Field statistic (fldsum, fldavg, fldstd, fldmin, fldmax,...) Vertical statistic (vertsum, vertavg, vertstd, vertmin,...) Time range statistic (timavg, yearavg, monavg, dayavg,...) Ensemble statistic (enssum, ensavg, ensstd, ensmin,...) Regression (detrend) Field interpolation (remapbil, remapcon, remapdis,...) Vertical interpolation (ml2pl, ml2hl) Time interpolation (inttime, intyear)

5 DKRZ and M&D Introduction course 2006 CDO Usage: cdo [options] \ operator[,op[,op]] \ [-operator] \ ifile [ifile...] [ofile] For: GRIB-, NetCDF-, ieg-, Service-, Extra- formatted files

6 DKRZ and M&D Introduction course 2006 CDO cdo info: info, infov sophie 29%cdo info zzz.grb -1 : Date Time Code Level Size Miss : Minimum Mean Maximum 1 : : : cdo info : Processed 1 variable 1 timestep. ( 0.00s 0B ) sophie 30%cdo infov zzz.grb -1 : Date Time Varname Level Size Miss : Minimum Mean Maximum 1 : :00 var : sophie 33%cdo -f nc copy zzz.grb zzz.nc cdo copy : Processed 1 variable 1 timestep. ( 0.01s 0B ) sophie 34%cdo infov zzz.nc -1 : Date Time Varname Level Size Miss : Minimum Mean Maximum 1 : :00 var : cdo infov : Processed 1 variable 1 timestep. ( 0.00s 0B ) sophie 35%cdo -f nc -t echam4 copy zzz.grb zzz.nc cdo copy : Processed 1 variable 1 timestep. ( 0.01s 0B ) sophie 36%cdo infov zzz.nc -1 : Date Time Varname Level Size Miss : Minimum Mean Maximum 1 : :00 tsmax : cdo infov : Processed 1 variable 1 timestep. ( 0.00s 0B )

7 DKRZ and M&D Introduction course 2006 CDO cdo info: map sophie 28%cdo sellonlatbox,-10,30,35,70 tsmax.grb tsmaxeuropa.grb sophie 29%cdo map tsmaxeuropa.grb m M =[+2.611e+02,+2.656e+02] 1=[+2.656e+02,+2.688e+02] 2=[+2.688e+02,+2.720e+02] 3=[+2.720e+02,+2.752e+02] 4=[+2.752e+02,+2.784e+02] 5=[+2.784e+02,+2.816e+02] 6=[+2.816e+02,+2.848e+02] 7=[+2.848e+02,+2.880e+02] 8=[+2.880e+02,+2.912e+02] 9=[+2.912e+02,+2.929e+02] *=0.=miss m=min=+2.611e+02 M=max=+2.929e+02

8 DKRZ and M&D Introduction course 2006 CDO cdo -r -f nc -t echam4 copy zzz.grb zzz.nc -r relative time axis -f nc output format is netcdf -t echam4 use parameter table echam4 converting a GRIB-file to NetCDF... cdo formats: -f cdo -f ext copy zzz.grb zzz.ext -f ext output format is extra converting a GRIB-file to extra... output is a formatted text file... cdo outputf,f8.3,5 zzz.grb zzz.asc f8.3 fortran format convention 5 values per line

9 DKRZ and M&D Introduction course 2006 CDO cdo -t mpiom1 -f nc setgrid,grob15s.nc \ -selindexbox,2,255,1,220 -setgrid,r256x220 \ filein.ext inter.nc cdo remapcon,r360x180 inter.nc fileout.nc interpolate a curve linear (extra file) to a regular grid (NetCDF) (MPI-OM1 to regular 360*180 grid for CMOR)

10 DKRZ and M&D Introduction course 2006 CDO example: piping, missing_values, etc cdo -f ext daymean MSLP.grb A1_psl cdo -f ext daymin T2MIN.grb A1_tasmin cdo -f ext daymax T2MAX.grb A1_tasmax cdo -f ext add -daymean APRL.grb -daymean APRC.grb A1_pr cdo -f ext sub -daymean TRADS.grb \ -daymean TRADSU.grb A1_rlds cdo -f ext sub -daymean SRADS.grb \ -daymean SRADSU.grb zwisch1_rsds cdo gtc,0.0 zwisch1_rsds zwisch2_rsds cdo setmisstoc,0.0 -ifthen zwisch2_rsds \ zwisch1_rsds A1_rsds cdo -f ext mulc,-1. -daymean AHFL.grb A1_hfls ifthen = i2(t,x) if i1 != 0 = miss if i1 = 0 gtc = 1 if i1 > 0 = 0 if i1 <= 0

11 DKRZ and M&D Introduction course 2006 CDO example: preparing for excel Step 1: time selection and download from data base jblob -datasetname EH4OPYC_TPREC -rmin rmax Step 2: daily mean: cdo daymean EH4OPYC_TPREC_ grb EH4OPYC_TPREC_day.grb Step 3: select region: cdo sellonlatbox,239,251,48,55 EH4OPYC_TPREC_day.grb \ EH4OPYC_TPREC_daycs.grb Step 4: set values < 0 to 0,change from ms-1 to mmd-1: cdo gtc,0.0 EH4OPYC_TPREC_daycs.grb EOmask cdo setmisstoc,0.0 -ifthen EOmask EH4OPYC_TPREC_daycs.grb \ EH4OPYC_TPREC_erg.grb cdo mulc, EH4OPYC_TPREC_erg.grb EH4OPYC_TPREC_mmd.grb Step 5: convert from GRIB to ascii: cdo outputf,%10.4f,5 EH4OPYC_TPREC_mmd.grb > EH4OPYC_TPREC.asc Step 6:convert from mac to windows (interactive editor) Step 7:pack: gzip EH4OPYC_22723GSDIO_TPREC.win.asc

12 DKRZ and M&D Introduction course 2006 CDO cdo gradsdes: GrADS description file cdo gradsdes zzz.grb zzz.ctl ---the GrADS description file zzz.gmp ---the INDEX file creates cdo outputbounds zzz.grb > zzz.txt creates sophie 25% more zzz.asc # File = zzz.nc # Name = T_2M # Code = -1 # Level = 2 # Date = # Time = 03:00 # > -Z > -Z

13 DKRZ and M&D Introduction course 2006 CDO cdo: infos, downloads, installations Current officially released version is cdo SUN ( Solaris 8): /client/bin SUN (Solaris 10)(zetta, jango): /pf/k/k204016/bin LINUX: /client/bin or local installations ( LINUX, Mac OS X): configure --with-netcdf=/sw make

14 DKRZ and M&D Introduction course 2006 Introduction Diagnostic cdos Visualisation gnuplot timeseries daily & monthly 2d field with contour & pm3d installation, etc... GrADS GMT cdat

15 DKRZ and M&D Introduction course 2006 cdo sellonlatbox,-10,30,35,70 -monmean TSMAX.grb eh5_mon_europe.grb cdo sellonlatbox,-10,30,35,70 $FILE eh5_day_europe.grb cdo info eh5_mon_europe.grb | tail +2 | head -12 \ | cut -c 10-19,72-79 > eur_mon.asc cdo info eh5_day_europe.grb | tail +2 | head -365 \ | cut -c 10-19,72-79 > eur_day.asc cdo + gnuplot for timeseries sophie 27%cdo info EH4_OPYC_SRES_A2_TSMAX_day.grb -1 : Date Time Code Level Size Miss : Minimum Mean Maximum 1 : : : : : : : : : : : : : : :

16 DKRZ and M&D Introduction course 2006 if (-e REINDA) rm REINDA cat > REINDA << ENDE set terminal post color set xdata time set timefmt "%Y-%m-%d" set format x "%m" set output "eur_mon_day.ps" plot "eur_day.asc" u 1:2 title "daily mean" w l, \ "eur_mon.asc" u 1:2 title "monthly mean" w l quit ENDE gnuplot < REINDA cdo + gnuplot for timeseries

17 DKRZ and M&D Introduction course 2006 cdo selrec,1,1 EH4_OPYC_SRES_A2_TSMAX_day.grb tsmax.grb cdo griddes tsmax.grb > tsmax.grid cdo -f ext copy tsmax.grb tsmax.ext f90 -o gp.x gp.f90 gp.x cdo + gnuplot for 2d field produces a file tsmax.asc: sophie 40%more tsmax.asc gp.f90: reads tsmax.ext (tsmax) reads tsmax.grid (lon, lat) writes ascii file (lon, lat, tsmax)

18 DKRZ and M&D Introduction course 2006 gnuplot gnuplot> set pm3d gnuplot> unset surface gnuplot> set contour base gnuplot> set view 0,0,1.2,1.2 gnuplot> set palette model RGB gnuplot> set palette defined \ ( 0 "#0033ff", 2 "#ffff33", 3 "#ffcccc", 5 "#ff0033") gnuplot> splot [0:360][-90:90][220:330] "tsmax.asc" with pm3d gnuplot> set term postscript color gnuplot> set output "gnutemp.ps" gnuplot> replot gnuplot> quit gnuplot for 2d field (pm3d only version 4.0)

19 DKRZ and M&D Introduction course 2006 gnuplot: infos, downloads, installations Current officially released version is gnuplot cross (version 3.7) : /usr/bin sun solaris (version 3.7) : /client/bin LINUX (version 3.7) : /usr/bin

20 DKRZ and M&D Introduction course 2006 Introduction Diagnostic cdos Visualisation gnuplot GrADS plot with default values plot with different colours plot with frames plot with additional text plot with vectors animation installation, etc... GMT cdat

21 DKRZ and M&D Introduction course 2006 'reinit' 'set vpage ' 'set display color white' 'clear' * 'sdfopen $FILE1' * 'set lon ' 'set gxout shaded' 'set parea ' 'set t 1' 'display sic' 'draw title sea ice cover Jan' 'set lon ' 'set gxout shaded' 'set parea ' 'set t 8' 'display sic' 'draw title sea ice cover Aug' * 'run cbar.gs' 'printim icex2.gif gif x480 y640 white'

22 DKRZ and M&D Introduction course 2006 function palette() ***************************** * * color palette fuer arktis * weiss-tuerkis-werte * Nr red green blue 'set rgb ' 'set rgb ' 'set rgb ' 'set rgb ' 'set rgb ' 'set rgb ' 'set rgb ' 'set rgb ' 'set rgb ' 'set rgb ' 'set rgb ' 'set rgb ' 'set rgb ' 'set rgb ' 'set rgb ' 'set cmin 0' 'set cmax 100' 'set clevs \ ' 'set ccols \ ' additive color system

23 DKRZ and M&D Introduction course 2006 'reinit' 'set vpage ' 'set display color white' 'clear' 'run palette.arktis.gs' 'sdfopen sic_O1_ nc' 'set cmin 0' 'set cmax 100' 'set clevs ' 'set ccols ' 'set lon ' 'set gxout shaded' 'set parea ' 'set t 1' 'display sic' 'draw title sea ice cover Jan' 'set cmin 0' 'set cmax 100' 'set clevs ' 'set ccols ' 'set lon ' 'set gxout shaded' 'set parea ' 'set t 8' 'display sic' 'draw title sea ice cover Aug' 'run cbar.gs'

24 DKRZ and M&D Introduction course 2006 'reinit' 'set vpage ' 'set display color white' 'clear' 'run palette.arktis.gs' * 'sdfopen $FILE1' * 'draw rec ' 'draw string first window' 'draw rec ' 'draw string second window' 'draw rec ' * 'set cmin 0' 'set cmax 100' 'set clevs ' 'set ccols ' 'set lon ' 'set gxout shaded' 'set parea ' 'set t 1' 'display sic' 'draw title sea ice cover Jan'

25 DKRZ and M&D Introduction course 2006 'set cmin 0' 'set cmax 100' 'set clevs ' 'set ccols ' 'set lon ' 'set gxout shaded' 'set parea ' 'set t 8' 'display sic' 'draw title sea ice cover Aug' * 'run cbar.gs' 'set string 4 c 2 0' 'draw string %' 'set font 4' 'set string 2 l 30 55' 'set strsiz 1' 'draw string GrADS 1.9b' 'printim icex2.gif gif x480 y640 white'

26 DKRZ and M&D Introduction course 2006 #!/bin/tcsh # # Script fuer ein gradsbild # set WORK = "$HOME/GRADStest" set FILE1 = uas_A1.nc set FILE2 = vas_A1.nc set FILE3 = speed_A1.nc # cd $WORK # cat > REIN.gs <

27 DKRZ and M&D Introduction course 2006

28 #!/bin/tcsh -vx set work = $HOME/DKRZcourse/GRADStest set bild = $work/gifs set ifile = templev.nc cd $work foreach z ( ) cat > REINDA << ENDE 'reinit' 'set vpage ' 'set display color white' 'clear' 'run palette.joerg3.gs' 'sdfopen $ifile' 'set parea ' 'set cmin 270' 'set cmax 302' 'set clevs ' 'set ccols ' 'set gxout shaded' 'set lev $z' 'display thetao' 'run cbar.gs' 'draw string Temp from surface to bottom: $z' 'printim./gifs/temp.$z.gif gif x600 y400 white' 'quit' ENDE gradsnc -lbc 'run REINDA' rm REINDA end set loopdim z set lev set z 1 40 display thetao

29 DKRZ and M&D Introduction course 2006 temp.0006.gif temp.0150.gif temp.0740.gif temp.2290.gif temp.0017.gif temp.0183.gif temp.0845.gif temp.2525.gif temp.0027.gif temp.0220.gif temp.0960.gif temp.2785.gif temp.0037.gif temp.0263.gif temp.1085.gif temp.3070.gif temp.0047.gif temp.0310.gif temp.1220.gif temp.3395.gif temp.0057.gif temp.0363.gif temp.1365.gif temp.3770.gif temp.0069.gif temp.0420.gif temp.1525.gif temp.4195.gif temp.0083.gif temp.0485.gif temp.1700.gif temp.4670.gif temp.0100.gif temp.0560.gif temp.1885.gif temp.5170.gif temp.0123.gif temp.0645.gif temp.2080.gif temp.5720.gif convert -delay 20 temp.*.gif ani20.gif cd./gifs foreach z ( \ \ ) if ( $z < 10 ) then mv temp.$z.gif temp.000$z.gif else if ( $z < 100 ) then mv temp.$z.gif temp.00$z.gif else if ( $z < 1000 ) then mv temp.$z.gif temp.0$z.gif endif end

30 DKRZ and M&D Introduction course 2006

31 GrADS: infos, downloads, installations Current officially released version is GrADS 1.8s11 cross (version 1.8sl11) : /pool/ia64/grads/ia32/bin sun solaris (version 1.8sl9): /client/bin LINUX (version 1.8) : /client/bin Running Version 1.9b4: MacOS X.4 setenv GADDIR ~/grads-1.9b4/data setenv GRADSDIR ~/bin

32 DKRZ and M&D Introduction course 2006 Introduction Diagnostic cdos Visualisation gnuplot GrADS GMT plot europe plot europe "conic" plot europe "and world" plot ocean data on curve linear grid installation, etc... cdat

33 DKRZ and M&D Introduction course 2006 cdo outputbounds ifile > ofile.asc psbasemap -R-15/40/35/75 -JM6i \ -B15/5:."Europa mit GMT":\ -P -K >! zzz.ps psxy -R -J -M zzz.asc -L \ -Czzz.cpt -P -O -K >> zzz.ps pscoast -R -J -Dc -W0.5p -P -O >> zzz.ps

34 DKRZ and M&D Introduction course 2006 cdo outputbounds ifile > ofile.asc makecpt -Crainbow -T240/300/3 > zzz.cpt psbasemap -R-15/40/35/75 -JB-10/30/35/65/6i \ -B15/5:."Europe Albers Conic": -P -K >! zzz.ps psxy -R -J -M zzz.asc -L -Czzz.cpt -P -O -K >> zzz.ps pscoast -R -J -Dc -W0.5p -P -O >> zzz.ps

35 DKRZ and M&D Introduction course 2006 #!/bin/tcsh # makecpt -Crainbow -T240/300/3 > zzz.cpt pscoast -R-180/180/-90/90 -JG10/35/6i -Bg30/g15 -Dc \ -A5000 -G255/255/255 \ -S150/50/150 -P -K >! zz1.ps psxy -R-12/37/35/70 -M zzz.asc -J -L -O -K -Czzz.cpt >> zz1.ps pscoast -R-180/180/-90/90 -JG10/35/6i -Bg30/g15 -Dc -A5000 -W0.5p \ -P -O >> zz1.ps

36 DKRZ and M&D Introduction course 2006 #!/bin/tcsh -vx set IFILE = $1 set OFILE = $2 set GFILE = $OFILE:r.gmt set CFILE = colorj.cpt set PFILE = $OFILE:r.ps #change from extra to netcdf and cutting the overlaps cdo -t mpiom1 -f nc setgrid,$HOME/cdogrids/grob15s.nc \ -selindexbox,2,255,1,220 \ -setgrid,r256x220 $IFILE $OFILE #create inputfile for gmt cdo outputbounds $OFILE > $GFILE #Cylindrical equidistant GMT output psbasemap -Rd -JQ0/8.0i -X1.5i -Y2.0i \ -Ba60f30/a30f15:."MPIOM ZO - Height above geoid": \ -K >! $PFILE psxy -R -J -M $GFILE -L -C./$CFILE -W0.5p \ -O -K >> $PFILE pscoast -R -J -W0.5p -G102/187/80 -Dc \ -O -K >> $PFILE psbasemap -R -J -Bg30/g15 -U/0.0i/-1.6i/"joergwegner" \ -O -K >> $PFILE psscale -C./$CFILE -D4.0i/-0.5i/4.0i/0.2ih -B2/:"[m]": \ -O >> $PFILE

37 DKRZ and M&D Introduction course 2006

38

39 psbasemap -Rd -JG-35/50/6.0i -X1.0i -Y2.0i \ -Ba60f30/a30f15:."MPIOM ZO - Height above geoid":\ -P -K >! $PFILE

40 DKRZ and M&D Introduction course 2006 gmt: infos, downloads, installations Current officially released version is gmt 4.1 cross (version ?) : not installed sun solaris (version 3.41) : /client/bin LINUX (version ?) : ?

41 DKRZ and M&D Introduction course 2006 Introduction Diagnostic cdos Visualisation gnuplot GrADS GMT cdat overview example installation, etc...

42 DKRZ and M&D Introduction course 2006

43

44 #!/usr/bin/env python import cdms, vcs, cdutil, Numeric, genutil, os, sys from cdms import MV from Numeric import * # f=cdms.open('clmt.nc', 'r') temp = f('T', time = (' :0:0.0', ' :0:0.0'),\ level = (29, 29),\ rlat = ( , ),\ rlon = ( , ),\ squeeze = 0, order = '0123') lob = f('lon') lab = f('lat') tla = temp.getLatitude() tlo = temp.getLongitude() # b=cdms.open('zbounds.bin','r') labb=b('variable_ ') lobb=b('variable_ ') la=cdms.createVariable(labb) lo=cdms.createVariable(lobb) print la.shape print lo.shape tla.setBounds(la) tlo.setBounds(lo) vis=vcs.init() te=temp[:] # vis.plot(te) vis.gif('zb3.eu0123.gif','r','l') cdat example on CLM output loading bounds for lon and lat from file and plotting temperature

45 DKRZ and M&D Introduction course 2006

46 cdat: infos, downloads, installations Current officially released version is cdat cross (version 4.0) : no Fortran support, no postscript output sun solaris (version 4.0) : no Fortran support LINUX (version ?) : not installed Running Version 4.0: MacOS X.4, LINUX (SUSE, Debian)(with gcc 4.0 or higher) setenv CDATHOME "/pf/k/k204083/cdat" setenv PYTHONHOME "/pf/k/k204083/cdat" setenv PYTHONPATH "$CDATHOME/lib/python2.4:$CDATHOME/bin: \ $CDATHOME/lib:." # set my_path = ( $PINGO./ $CDO $PYTHONPATH )

47 DKRZ and M&D Introduction course 2006


Download ppt "DKRZ and M&D Introduction course 2006 Diagnostic & Visualisation Introduction Diagnostic cdo Visualisation gnuplot GrADS GMT cdat."

Similar presentations


Ads by Google