Diagnostic Visualisation

Document Sample
Diagnostic Visualisation Powered By Docstoc
					DKRZ and M&D Introduction course 2007



                                        Diagnostic & Visualisation
                                                • Introduction
                                                • Diagnostic
                                                    • cdo
                                                    • nco
                                                • Visualisation
                                                    • GrADS
                                                    • GMT
DKRZ and M&D Introduction course 2007

                                         fetching data
                                        from data base



                                         quick look
                                        ncview, xconv



                                          diagnostic
                                           cdo, nco




                                         visualisation
                                             grads
DKRZ and M&D Introduction course 2007
                                        tiny 53%cd VisData/Daten/
                                        tiny 54%ls -l
                                        -rw-r--r--    1 joerg joerg    89982824   Jun    7 2006 CLM_A1B_1_D2_d_T_S.nc
                                        -rw-r--r--    1 joerg joerg   492275748   Jun    9 2006 CLM_A1B_1_D3_3h_PMSL.nc
                                        -rw-r--r--    1 joerg joerg   492276956   Jun    9 2006 CLM_A1B_1_D3_3h_REL_HUM.nc
                                        -rw-r--r--    1 joerg joerg   492275872   Jun    9 2006 CLM_A1B_1_D3_3h_T_2M.nc
                                        -rw-r--r--    1 joerg joerg    61686976   Jun    7 2006 CLM_A1B_1_D3_dm_T_G.nc
                                        -rw-r--r--    1 joerg joerg    16777216   Oct   20 2003 EH3_t21_atm.nc
                                        -rw-r--r--    1 joerg joerg    16777216   Oct   20 2003 EH3_t21_bot.nc
                                        -rw-r--r--    1 joerg joerg    29649600   Jun    7 2006 EH4_t42_tsmax.grb
                                        -rw-r--r--    1 joerg joerg      664560   Jul    6 2006 EH5_OM_A1B_1_MM_APRC.grb
                                        -rw-r--r--    1 joerg joerg      664560   Jul    6 2006 EH5_OM_A1B_1_MM_APRL.grb
                                        -rw-r--r--    1 joerg joerg      443376   Jul    6 2006 EH5_OM_A1B_1_MM_APS.grb
                                        -rw-r--r--    1 joerg joerg      443376   Nov    2 07:14 EH5_OM_A1B_1_MM_MSLP.grb
                                        -rw-r--r--    1 joerg joerg       36948   Jul    5 2006 EH5_OM_CONST_GEOSP_1.grb
                                        -rw-r--r--    1 joerg joerg    13302720   Jun   13 2006 EH5_T2MAX_2040-2069_mon.grb
                                        -rw-r--r--    1 joerg joerg    13302720   Jun   13 2006 EH5_T2MIN_1960-1989_mon.grb
                                        -rw-r--r--    1 joerg joerg    13302720   Jun   13 2006 EH5_T2MIN_2040-2069_mon.grb
                                        -rw-r--r--    1 joerg joerg    19938240   Jun   13 2006 EH5_TPREC_1960-1989_mon.grb
                                        -rw-r--r--    1 joerg joerg    19938240   Jun   13 2006 EH5_TPREC_2040-2069_mon.grb
                                        -rw-r--r--    1 joerg joerg    28011372   Jun    7 2006 OM_r360_tos.nc
                                        -rw-r--r--    1 joerg joerg    31122196   Jun    7 2006 OM_r360_uo.nc
                                        -rw-r--r--    1 joerg joerg    31122196   Jun    7 2006 OM_r360_vo.nc
                                        -rw-r--r--    1 joerg joerg       10132   Mar   28 10:53 tsurf.1.nc
                                        -rw-r--r--    1 joerg joerg        4184   Mar   28 10:55 tsurf.1.grb
DKRZ and M&D Introduction course 2007
                                        tiny 23%cdo info tsurf.1.nc
                                            -1 :       Date Time Code Level Size Miss : Minimum                 Mean   Maximum
                                             1 : 1978-01-02 00:00 169       0 2048      0 :   226.98          268.46    311.08
                                        cdo info : Processed 1 variable 1 timestep. ( 0.00s )


                                                                            <-- 64 values for longitude -->
                                           <-- 32 values for latitude -->
DKRZ and M&D Introduction course 2007




                       t
                           t+1
                             t+2
                                t+3
                                  t+4
                                    t+5
                                          2d fields timeseries
DKRZ and M&D Introduction course 2007




                                        var(lat,lon) time records        var(time,lat,lon)


                                              4 3 1 0
                                              4 3 1 0                    11 24 36 47
                                               4 3 1 0
                                                4 3 1 0                             0
                                                                              39 710 1
                                                                           6847 38 1 0
                                              2 4 3 1 0
                                              2 55 77 99                 52 65 3 9
                                               2 55 77 99                     51 2
                                                                                 7 9
                                                                           272 65 57 49
                                              8 2 5 5 7 69
                                              8 2 5 10 6
                                                 5 10                       10
                                                                         912 4 3 6
                                               8 5 10 6
                                                8 5 10 6                      1 12 9 6
                                                                           818 25 310 6
                                                8     10 6
                                              here: var(3,4) 5 records        var(5,3,4)
DKRZ and M&D Introduction course 2007

                                         fetching data
                                        from data base



                                         quick look
                                        ncview, xconv



                                          diagnostic
                                           cdo, nco




                                         visualisation
                                             grads
DKRZ and M&D Introduction course 2007   tiny 54%xconv




                                         xconv, infos and download:
                                         http://badc.nerc.ac.uk/help/software/xconv/
DKRZ and M&D Introduction course 2007   tiny 54%ncview CLM_A1B_1_D2_d_T_S_1-366.nc
            abs acos add addc asin atan atan2 cat chcode chlevel chlevelc chlevelvchltype chvar const
            copy cos dayavg daymax daymean daymin daypctldaystd daysum dayvar delcode delvar detrend
            diff diffv div divdivdpm divdpy dumpmap dv2ps dv2uv dv2uvl eca_cdd eca_cfd eca_csueca_cwd
            eca_cwdi eca_cwfi eca_etr eca_fd eca_fdns eca_gsl eca_hdeca_hwdi eca_hwfi eca_id eca_r10mm
DKRZ and M&D Introduction course 2007
            eca_r20mm eca_r75p eca_r75pto eca_r90p eca_r90ptot eca_r95p eca_r95ptot eca_r99p
            eca_r99ptot eca_rr1 eca_rx1day eca_rx5day eca_sdii eca_strwind eca_su eca_tg10p eca_tg90p




                                                cdo
            eca_tn10p eca_tn90p eca_tr eca_tx10p eca_tx90p enlarge ensavg ensmax ensmean ensmin enspctl
            ensstd enssum ensvar eq exp expr exprf filedes fldavg fldmax fldmean fldmin fldpctl fldstd
            fldsum fldvar ge gec genbic genbil gencon gendis gp2sp gp2spl gradsdes1 gradsdes2 griddes
            griddes2 gt gtc hi houravg hourmax hourmean hourmin hourpctl hourstd hoursum hourvar
            ifnotthen ifnotthenc ifthen ifthenc ifthenelse info infov input inputext inputsrv int
            intarea interpolate intgridbil intntime intpoint inttime intyear invertlat invertlatdata
                                        climate data operators
            invertlatdes invertlon invertlondata invertlondes le lec ln log10 lt ltc map maskindexbox
            masklonlatbox mastrfu max meravg merge mergetime mermax mermean mermin merpctl merstd
            mersum mervar min ml2hl ml2pl monavg monmax monmean monmin monpctl monstd monsum monvar mul
            mulc muldpm muldpy ncode ndate ne nec nint nlevel nmon ntime nvar nyear output outputext
            outputf outputfld outputint outputsrv outputts partab random remap remapbic remapbil
            remapcon remapcon1 remapdis remapdis1 replace rotuvb runavg runmax runmean runmin runpctl
            runstd runsum runvar seasavg seasmax seasmean seasmin seaspctl seasstd seassum seasvar
            selall selavg selcode seldate selday selgrid selgridname selhour selindexbox sellevel
            sellonlatbox selltype selmax selmean selmin selmon selpctl selrec selseas selsmon selstd
            selstdname selsum seltabnum seltime seltimestep selvar selvar selyear selzaxis selzaxisname
            setcalendar setcindexbox setclonlatbox setcode setctomiss setdate setday setgatt setgatts
            setgrid setgridarea setgridtype setlevel setltype setmisstoc setmissval setmon setpartab
            setpartabv setreftime setrtomiss settaxis settime settunits setvar setyear setzaxis
            shifttime showcode showdate showformat showlevel showltype showmon showstdname showtime
            showvar showyear sin sinfo sinfop sinfov sp2gp sp2gpl sp2sp spcut splitcode splitday
            splitgrid splithour splitlevel splitmon splitrec splitseas splitvar splityear splitzaxis
            sqr sqrt sub subc subtrend tan taxisdes tchill timavg timmax timmean timmin timpctl timsort
            timstd timsum timvar topo trend uv2dv uv2dvl vardes vardup varmul vct vertavg vertmax
            vertmean vertmin vertstd vertsum vertvar vlist ydayavg ydaymax ydaymean ydaymin ydaypctl
DKRZ and M&D Introduction course 2007
                                        There are more than 300 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)*
DKRZ and M&D Introduction course 2007


                                        Usage:
                                          cdo [options]          \
                                              operator[,op[,op]] \
                                              [-operator]        \
                                              ifile [ifile ...] [ofile]

                                        For:
                                          GRIB-, NetCDF-, ieg-, Service-, Extra-
                                          formatted files
DKRZ and M&D Introduction course 2007


                                        Options:
                                          -a             Convert from relative to absolute time axis
                                          -f <format>    output file format.(grb, nc, nc2, srv, ext or ieg)
                                          -g <grid>      Grid name or file. Available grids:
                                                         t<RES>grid,t<RES>spec,r<NX>x<NY>,g<NX>x<NY>,ni<NI>
                                          -h             Help information for the operators
                                          -m <missval>   Set the default missing value (default: -9e+33)
                                          -b <nbits>     Set the precision of the output data in bytes
                                                         (32/46 for nc, nc2, srv, ext, ieg; 1-32 for grb)
                                          -R             Convert GRIB data from reduced to regular grid
                                          -r             Convert from absolute to relative time axis
                                          -t <partab>    Parameter table name or file
                                                         Predefined tables: echam4 echam5 mpiom1 ecmwf remo
                                          -V             Print the version number
                                          -v             Print extra details for some operators
                                        cdo info: info, infov
DKRZ and M&D Introduction course 2007




                                        sophie 29%cdo info zzz.grb
                                        -1 :     Date Time Code Level Size Miss : Minimum    Mean Maximum
                                         1 : 24-01-01 18:00 214      0 8192     0 : 229.31 279.04 327.19
                                        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 : 24-01-01 18:00 var214     0   8192    0 : 229.31 279.04 327.19

                                        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 : 24-01-01 18:00 tsmax       0 8192    0 : 229.31 279.04    327.19
                                        cdo infov : Processed 1 variable 1 timestep. ( 0.00s 0B )
                                        cdo formats: -f
DKRZ and M&D Introduction course 2007

                                        converting a GRIB-file to extra...
                                               cdo -f ext copy zzz.grb zzz.ext

                                               -f ext output format is extra

                                        output is a formatted text file...
                                               cdo outputf,%8.3g,5 zzz.grb zzz.asc

                                               %8.3g c format convention
                                               5     values per line

                                        converting a GRIB-file to NetCDF...
                                               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
                                                     How a parameter table looks like:
DKRZ and M&D Introduction course 2007

                                                     134   aps      surface pressure [Pa]
                                                     141   sn       snow depth [m]
                                                     147   ahfl     latent heat flux [W/m**2]
                                                     172   slm      land sea mask
                                                     175   albedo   surface albedo
                                                     211   siced    ice depth [m]

                                                     Example:
                                                     cdo -f nc -t tab2 file.grb file.nc
                                                     cdo infov file.nc
                                        tiny 78%cdo infov sechs2.grb
                                            -1 :       Date Time Varname Level   Size   Miss   :   Minimum      Mean     Maximum
                                             1 : 1978-12-31 00:00 aps        0   2048      0   :     58574.    97057. 1.0789e+05
                                             2 : 1978-12-31 00:00 sn         0   2048      0   :     0.0000 0.0058780    0.16087
                                             3 : 1978-12-31 00:00 ahfl       0   2048      0   :    -362.71   -60.509     3.8557
                                             4 : 1978-12-31 00:00 slm        0   2048      0   :     0.0000   0.33105     1.0000
                                             5 : 1978-12-31 00:00 albedo     0   2048      0   :   0.070000   0.28956    0.80000
                                             6 : 1978-12-31 00:00 siced      0   2048      0   :     0.0000   0.31012     3.6166
DKRZ and M&D Introduction course 2007




                                         interpolate a curve linear (extra file)
                                         to a regular grid (NetCDF)
                                        (MPI-OM1 to regular 360*180 grid for IPCC)

                                        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
                                        example: piping, missing_values, etc
DKRZ and M&D Introduction course 2007

                                        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 nc add -daymean APRL.grb -daymean APRC.grb A1_pr.nc

                                        cdo gec,100 CLM_A1B_1_D3_ms_RAIN_TOT_1-720.nc \
                                                    CLM_A1B_1_D3_y_m100.1-720.nc

                                        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   gtc   = 1 if i1 > 0
                                               = miss    if i1 = 0          = 0 if i1 <= 0
DKRZ and M&D Introduction course 2007

                                        example: preparing for excel
                                        Step 1: time selection and download from data base
                                        jblob -datasetname EH4OPYC_TPREC -rmin 71941 -rmax 93544
                                        Step 2: daily mean:
                                        cdo daymean EH4OPYC_TPREC_71941-93544.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,86400000 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
DKRZ and M&D Introduction course 2007

                                        cdo: infos, downloads, installations


                                        Current officially released version is cdo 1.07

                                        http://www.mpimet.mpg.de/fileadmin/software/cdo/

                                        ZMAW SUN:                      /client/bin
                                        DKRZ NEC ia64:                 /pool/ia64/cdo/bin
                                        ZMAW LINUX:                     /client/bin


                                        or local installations ( LINUX, Mac OS X, Windows with cygwin):

                                         configure --with-netcdf=/sw
                                         make
DKRZ and M&D Introduction course 2007



                                                                 NCO
                                                               NetCDF Operators

                                        The operators are:
                                        	

•	

   ncatted - attribute editor
                                        	

•	

   ncdiff - differencer
                                        	

•	

   ncea - ensemble averager
                                        	

•	

   ncecat - ensemble concatenator
                                        	

•	

   ncflint - file interpolator
                                        	

•	

   ncks - kitchen sink (extract, cut, paste, print data)
                                        	

•	

   ncra - running averager
                                        	

•	

   ncrcat - record concatenator
                                        	

•	

   ncrename - renamer
                                        	

•	

   ncwa - weighted averager
                                                            A NetCDF fileheader (part)
DKRZ and M&D Introduction course 2007

                                                             tiny 122%ncdump -h CLM_C20_1_D2_f_LAT.nc
                                                             netcdf CLM_C20_1_D2_f_LAT {
                                                             dimensions:
                                                                     rlat = 255 ;
                                                                     rlon = 241 ;
                                                                     time = UNLIMITED ; // (1 currently)
                                                             variables:
                                                                     float lat(time, rlat, rlon) ;
                                                                             lat:standard_name = "latitude" ;
                                                                             lat:long_name = "latitude" ;
                                        What I have:                         lat:units = "degrees_north" ;
                                        tiny 123%ncdump -h lat.201.nc
                                        netcdf lat.201 {
                                        dimensions:
                                                rlat = 255 ;
                                                rlon = 241 ;
                                        variables:
                                                float lat(rlat, rlon) ;
                                                         lat:standard_name = "latitude" ;
                                                         lat:long_name = "latitude" ;
                                                         lat:units = "degrees_north" ;
DKRZ and M&D Introduction course 2007
                                        cutout time
                                        tiny 173%ncks -v time -o time.nc hsurf.nc
                                        tiny 174%ncdump -h time.nc
                                        netcdf time {
                                        dimensions:
                                                time = UNLIMITED ; // (1 currently)
                                        variables:
                                                double time(time) ;
                                                        time:standard_name = "time" ;
                                                        time:long_name = "time" ;
                                                        time:units = "seconds since 1955-01-01 00:00:00" ;
                                                        time:calendar = "proleptic_gregorian" ;
                                                        time:bounds = "time_bnds" ;
DKRZ and M&D Introduction course 2007
                                        add new dimension


                                          tiny 177%ncecat ../lat.201.nc CLM_C20_1_D2_f_LAT.nc
                                          tiny 178%ncdump -h CLM_C20_1_D2_f_LAT.nc
                                          netcdf CLM_C20_1_D2_f_LAT {
                                          dimensions:
                                                  rlat = 255 ;
                                                  rlon = 241 ;
                                                  record = UNLIMITED ; // (1 currently)
                                          variables:
                                                  float lat(record, rlat, rlon) ;
                                                          lat:standard_name = "latitude" ;
                                                          lat:long_name = "latitude" ;
                                                          lat:units = "degrees_north" ;
DKRZ and M&D Introduction course 2007
                                        rename record



                                           tiny 179%ncrename -d record,time CLM_C20_1_D2_f_LAT.nc
                                           tiny 180%ncdump -h CLM_C20_1_D2_f_LAT.nc
                                           netcdf CLM_C20_1_D2_f_LAT {
                                           dimensions:
                                                   rlat = 255 ;
                                                   rlon = 241 ;
                                                   time = UNLIMITED ; // (1 currently)
                                           variables:
                                                   float lat(time, rlat, rlon) ;
                                                           lat:standard_name = "latitude" ;
                                                           lat:long_name = "latitude" ;
                                                           lat:units = "degrees_north" ;
                                        tiny 181%ncks -A -v time -o CLM_C20_1_D2_f_LAT.nc time.nc
                                        tiny 182%ncdump -h CLM_C20_1_D2_f_LAT.nc
DKRZ and M&D Introduction course 2007
                                        netcdf CLM_C20_1_D2_f_LAT {
                                        dimensions:                                         add time
                                                rlat = 255 ;
                                                rlon = 241 ;
                                                time = UNLIMITED ; // (1 currently)
                                        variables:
                                                float lat(time, rlat, rlon) ;
                                                        lat:standard_name = "latitude" ;
                                                        lat:long_name = "latitude" ;
                                                        lat:units = "degrees_north" ;
                                                float rlat(rlat) ;
                                                        rlat:standard_name = "grid_latitude" ;
                                                        rlat:long_name = "rotated latitude" ;
                                                        rlat:units = "degrees" ;
                                                float rlon(rlon) ;
                                                        rlon:standard_name = "grid_longitude" ;
                                                        rlon:long_name = "rotated longitude" ;
                                                        rlon:units = "degrees" ;
                                                double time(time) ;
                                                        time:standard_name = "time" ;
                                                        time:long_name = "time" ;
                                                        time:units = "seconds since 1955-01-01 00:00:00" ;
                                                        time:calendar = "proleptic_gregorian" ;
                                                        time:bounds = "time_bnds" ;
DKRZ and M&D Introduction course 2007

                                        nco: infos, downloads, installations


                                        Current officially released version is 3.1.9

                                        http://nco.sourceforge.net

                                        http://www.mad.zmaw.de/imdi/dpv/processing/


                                        cross (version 3.0.0) : /pool/ia64/nco-3.0.0/bin
                                        sun solaris (version 2.73) : /client/bin
                                        LINUX (version 2.9.9) : /client/bin
DKRZ and M&D Introduction course 2007




                                             GrADS
                                        grid analysis and display system
                                        Input: GRIB file:                     Input: NetCDF FILE:
                                                                GrADS Call
DKRZ and M&D Introduction course 2007
                                        cdo gradsdes file.grb
                                                                              file.nc
                                        creates
                                                                              gradsnc -p
                                        file.ctl                              ga->sdfopen file.nc
                                        file.gmp
                                                                GrADS Dims
                                        gradsc -p
                                        ga->open file.ctl




                                                   z                y    t   x=lon
                                                                             y=lat
                                                                             z=level
                                                        x                    t=time
                                        cdo gradsdes: GrADS description file
DKRZ and M&D Introduction course 2007

                                        cdo gradsdes zzz.grb                                creates
                                        * Generated automatically by cdo version 0.9.13
                                        *
                                        DSET ^zzz.grb                       zzz.ctl        ---the GrADS description file
                                        DTYPE GRIB                          zzz.gmp        ---the INDEX file
                                        INDEX ^zzz.gmp
                                        XDEF 128 LINEAR 0.000000 2.812500
                                        YDEF 64 LEVELS
                                                        -71.158 -68.368 -65.578 -62.787 -59.997 -57.207
                                                        -54.416 -51.626 -48.835 -46.045 -43.254 -40.464
                                                        -37.673 -34.883 -32.092 -29.301 -26.511 -23.720
                                                        -20.930 -18.139 -15.348 -12.558 -9.767 -6.977
                                                         -4.186 -1.395    1.395   4.186   6.977   9.767
                                                         29.301 32.092 34.883 37.673 40.464 43.254
                                                         46.045 48.835 51.626 54.416 57.207 59.997
                                                         62.787 65.578 68.368 71.158 73.948 76.737
                                                         79.526 82.313 85.097 87.864
                                        ZDEF 1 LEVELS 0
                                        TDEF 24 LINEAR 18:00Z01jan0024 1dy
                                        TITLE zzz.grb T42 grid
                                        OPTIONS yrev
                                        UNDEF -9e+33
                                        VARS 1
                                        var214              0 214,1,0 var214
                                        ENDVARS
DKRZ and M&D Introduction course 2007




       gradsc -l
                                        tiny 34%gradsc -l
                                        ga-> d t2max
DKRZ and M&D Introduction course 2007
                                        Contouring: 240 to 310 interval 10
                                        ga-> c
                                        ga-> set lon 10
                                        LON set to 9.375 9.375
                                        ga-> set lat 54
                                        LAT set to 53.16 53.16
                                        ga-> set t 1
                                        Time values set: 1960:1:31:18 1960:1:31:18
                                        ga-> d t2max
                                        Result value = 271.993
                                        ga-> set t 1 12
                                        Time values set: 1960:1:31:18 1960:12:4:18

                                        ga-> d t2max
                                        ga-> c
                                        ga-> set lon 0 360
                                        LON set to 0 360
                                        ga-> set lat 54
                                        LAT set to 53.16 53.16
                                        ga-> set t 2
                                        Time values set: 1960:2:28:18 1960:2:28:18
                                        ga-> d t2max
                                        ga-> quit
                                        'reinit'
DKRZ and M&D Introduction course 2007
                                        'set vpage 0 8.5 0 11'
                                        'set display color white'
                                        'clear'
                                        *
                                        'sdfopen $FILE1'
                                        *
                                        'set lon -180 180'
                                        'set gxout shaded'
                                        'set parea 0.5 6.5 0.5 5.25'
                                        'set t 1'
                                        'display sic'
                                        'draw title sea ice cover Jan'

                                        'set lon -180 180'
                                        'set gxout shaded'
                                        'set parea 0.5 6.5 5.75 10.5'
                                        'set t 8'
                                        'display sic'
                                        'draw title sea ice cover Aug'
                                        *
                                        'run cbar.gs'
                                        'printim icex2.gif gif x480 y640 white'
                                                                              additive color system
DKRZ and M&D Introduction course 2007
                                        function palette()
                                        *****************************
                                        *
                                        * color palette fuer arktis
                                        * weiss-tuerkis-werte
                                        *         Nr red green blue
                                        'set rgb 16 240 250 250'
                                        'set rgb 17 225 240 245'
                                        'set rgb 18 210 230 240'
                                        'set rgb 19 195 220 235'
                                        'set rgb 20 180 210 230'
                                        'set rgb 21 165 200 225'
                                        'set rgb 22 150 190 220'
                                        'set rgb 23 135 180 215'        'set cmin 0'
                                        'set rgb 24 120 170 210'        'set cmax 100'
                                        'set rgb 25 105 160 205'        'set clevs 8 16 24 32 40 48 56 64 \
                                        'set rgb 26    90 150 200'                 72 80 88 96'
                                        'set rgb 27    75 140 195'      'set ccols 16 17 18 19 20 21 22 23 \
                                        'set rgb 28    60 130 190'                 24 25 26 27 28 29'
                                        'set rgb 29    45 120 185'
                                        'set rgb 30    30 110 180'
                                        'reinit'
DKRZ and M&D Introduction course 2007
                                        'set vpage 0 8.5 0 11'
                                        'set display color white'
                                        'clear'
                                        'run palette.arktis.gs'
                                        'sdfopen sic_O1_1860-2000.nc'
                                        'set cmin 0'
                                        'set cmax 100'
                                        'set clevs 8 16 24 32 ... 64 72 80 88 96'
                                        'set ccols 16 17 ...23 24 25 26 27 28 29'
                                        'set lon -180 180'
                                        'set gxout shaded'
                                        'set parea 0.5 6.5 0.75 4.5'
                                        'set t 1'
                                        'display sic'
                                        'draw title sea ice cover Jan'
                                        'set cmin 0'
                                        'set cmax 100'
                                        'set clevs 8 16 24 32 ...64 72 80 88 96'
                                        'set ccols 16 17 ...23 24 25 26 27 28 29'
                                        'set lon -180 180'
                                        'set gxout shaded'
                                        'set parea 0.5 6.5 5.5 9.25'
                                        'set t 8'
                                        'display sic'
                                        'draw title sea ice cover Aug'
                                        'run cbar.gs'
DKRZ and M&D Introduction course 2007
                                        tiny 93%more eutin.gs
                                        #!/bin/tcsh
DKRZ and M&D Introduction course 2007
                                        #
                                        # timeseries + lonlat graphic
                                        # settings:
                                        set SCRIPT = "/Users/joerg/VisData/FrankPoster/Scripte"
                                        set FILE2 = CLM_A1B_1_D3_yn_RR1MM_1-52.nc
                                        set FILE1 = CLM_A1B_1_D3_yn_RR1MM_eutinmean2.nc
                                        set PICNAME = $1
                                        set WORK = "/Users/joerg/VisData/FrankPoster/Daten"
                                        cd $WORK
                                        # the grads script:
                                        cat > REIN.gs <<ENDE

                                               the grads script is here
                                        ENDE
                                        # start gradsnc with gradsscript:
                                        gradsnc -lc 'run REIN.gs'
                                        #
                                        # delete gradsscript:
                                        rm REIN.gs
                                        #
                                        # leave shellscript:
                                        exit
                                        #
                                        'reinit'
DKRZ and M&D Introduction course 2007
                                        'set vpage 0 11 0 8.5'
                                        'set display color white'
                                        'clear'
                                                                        the big picture
                                                                        the small picture

                                                                        the city
                                                                        the recs and lines
                                                                        the words
                                        * print:
                                        'enable print pic.mf'
                                        'print'
                                        'disable print'
                                        '!gxps -c -i pic.mf -o ${PICNAME}.ps'
                                        *
                                        * leave grads:
                                        'quit'
DKRZ and M&D Introduction course 2007



                                        * the big pic:
                                        'sdfopen $FILE1'
                                        'set parea 1 10 1 6.5'
                                        'set ccolor 2'
                                        'set cthick 6'
                                        'set gxout line'
                                        'set rgb 99 5 5 5'
                                        'set grid on 5 99'
                                        'set t 1 52'
                                        'display rr1mm'
                                        'close 1'
                                        *
DKRZ and M&D Introduction course 2007


                                        * the small pic 1:
                                        'sdfopen $FILE2'
                                        'set parea 3.0 7.0 5.2 8.2'
                                        'set mpdset hires'
                                        'set map 1 1 6'
                                        'set mproj latlon'
                                        'set gxout grfill'
                                        'set xlab off'
                                        'set ylab off'
                                        'run $SCRIPT/palette.joerg3.gs'
                                        'set clevs      140 145 150 155 160 165 170 175 180 185 190 195'
                                        'set ccols 41 40 54 53 39 38 37 36 35 34 33 32 31 30'
                                        'set lon 8 12'
                                        'set lat 53 55.5'
                                        'set t 6'
                                        'display rr1mm'
                                        'run $SCRIPT/cbar_6on1.gs'
                                        *******************
DKRZ and M&D Introduction course 2007
                                        *
                                        * plot the city Eutin in the right place:
                                        city=Eutin
                                        latd=54
                                        latm=08/60
                                        lond=10
                                        lonm=37/60
                                        lat=latd+latm
                                        lon=lond+lonm
                                        *
                                        * compute pic equiv. to lon lat:
                                        'q w2xy 'lon' 'lat; res=result
                                        x=subwrd(res,3); y=subwrd(res,6)
                                        *
                                        * draw point:
                                        'set line 1'; 'draw mark 3 'x' 'y' 0.075'
                                        'set line 0'; 'draw mark 2 'x' 'y' 0.075'
                                        *
                                        * draw name:
                                        'draw string 'x' 'y+0.1' 'city
                                        ********************
DKRZ and M&D Introduction course 2007




                                        *
                                        * draw rectandular around 9 gridboxes:
                                        'set line 2 1 4'
                                        'draw rec 5.3 6.3 5.9 7.0'
                                        *
                                        * draw line from box to big curve:
                                        'set line 2 1 4'
                                        'draw line 5.3 6.3 2.2 4.5'
                                        *
                                        * draw line from graphic 1 to 2006:
                                        'set line 54 1 6'
                                        'draw line 3.0 5.7 1.87 5.7'
                                        'draw line 1.87 5.7 1.87 4.15'
                                        'set string 54 c 2 90'
                                        'draw string 1.75 5.0 year 2006'
                                        * draw text:
DKRZ and M&D Introduction course 2007
                                        'set strsiz 0.1 0.1'
                                        'set string 2 l 2 30'
                                        'draw string 2.8 4.7 field mean over 9 boxes'
                                        'set font 4'
                                        'set strsiz 0.15 0.14'
                                        'set string 54 c 4 0'
                                        'draw string 5.5 0.5 Days per Year with more than 1 mm precipitation'
                                        'set strsiz 0.1 0.1'
                                        'set string 54 l 1 0'
                                        'draw string 7.1 8.0 timeseries over 52 years'
                                        'set string 54 l 2 0'
                                        'draw string 7.1 7.8 days per year with prec. > 1mm'
                                        'set string 54 l 3 0'
                                        'draw string 7.1 7.6 the mean was calculated over 9'
                                        'set string 54 l 4 0'
                                        'draw string 7.1 7.4 gridboxes. Eutin was choosen '
                                        'set string 54 l 5 0'
                                        'draw string 7.1 7.2 because it is 1 station in WettReg'
                                        'set string 54 l 6 0'
                                        'draw string 7.1 7.0 a statistical climate forecast program.'
                                        'set string 32 r 1 0'
                                        'draw string 2.9 8.0 dataset from SGA_CLM:'
                                        'set string 32 r 2 0'
                                        'draw string 2.9 7.8 CLM_A1B_1_D3_yn_RR1MM.nc'
                                        'set string 32 r 3 0'
                                        'draw string 2.9 7.6 Mean calculated with cdo:'
                                        'set string 32 r 4 0'
                                        'draw string 2.9 7.4 cdo fldmean -sellonlatbox'
                                        'set string 32 r 5 0'
                                        'draw string 2.9 7.2 lat 53.8,54.6; lon 10.2,10.8'
                                        'set string 32 r 6 0'
                                        'draw string 2.9 7.0 gradsscript: eutin.gs'
                                        #!/bin/tcsh
                                        #
DKRZ and M&D Introduction course 2007
                                        # Script fuer ein gradsbild
                                        #
                                        set WORK = "$HOME/GRADStest"      *
                                        set FILE1 = uas_A1.nc             'set lon -30 40'
                                        set FILE2 = vas_A1.nc             'set lat 20 75'
                                        set FILE3 = speed_A1.nc           'set gxout shaded'
                                        #                                 'display uas.3'
                                        cd $WORK                          'set gxout vector'
                                        #                                 'set t 1'
                                        cat > REIN.gs <<ENDE              'set arrscl .3 10'
                                        'reinit'                          'display uas.1;vas.2'
                                        'set vpage 0 11 0.5 8.5'          *
                                        'set display color white'         'run cbar.gs'
                                        'clear'                           'draw string 1.9 0.2 Windspeed und Direction'
                                        'run palette.joerg3.gs'           'printim gifimage.out gif x800 y600 white'
                                        *                                 *
                                        'sdfopen $FILE1'                  'quit'
                                        'sdfopen $FILE2'                  *
                                        'sdfopen $FILE3'                  ENDE
                                        'set parea 1 10 1 8'              #
                                        'set map 2 1 10'                  gradsnc -lc 'run REIN.gs'
                                        *                                 #
                                        'set cmin 0'
                                        'set cmax 27'
                                        'set clevs 3 6 9 12 15 18 21 24 27'
                                        'set ccols 38 39 40   ... 46 47 48'
DKRZ and M&D Introduction course 2007
DKRZ and M&D Introduction course 2007




                     where am I

               ?
                                        tiny 188%more citytest.gs
                                        *
DKRZ and M&D Introduction course 2007
                                        'reinit'
                                        'set vpage 0 11 0 8.5'
                                        'set parea 0.5 10.8 1.0 8.0'
                                        *
                                        'sdfopen CLM_A1B_1_D3_3h_PMSL_1-2921.nc'
                                        'set mpdset hires'
                                        'set poli on'
                                        'set gxout grfill'
                                        'set t 168'
                                        'set lat 51 53.6'
                                        'set lon 10.2 13.2'
                                        *
                                        * get variable name
                                        'query file'; gf=result
                                        line=sublin(gf,7); var=subwrd(line,1)
                                        'display 'var
                                        *
                                        'run cities.gs'
                                        'enable print wobinich.mf'
                                        'print'
                                        'disable print'
                                        '!gxps -c -i wobinich.mf -o hier3.ps'
                                        *'quit'
                                        tiny 191%more cities.gs
                                        *-----------------------
                                        function draw_cities()
DKRZ and M&D Introduction course 2007
                                                                               tiny 189%more German_Cities.txt
                                        *-----------------------               #City           Lat(o ')        Lon(o ')
                                                                               #----------------------------------------
                                        input='German_Cities.txt'              Aachen          50 46           6 6
                                                                               Altenburg       50 59           12 26
                                         rc=read(input); stat=sublin(rc,1)     Anklam          53 51           13 41
                                         code......                            Ansbach         49 18           10 35
                                                                               Arnstadt        50 50           10 57
                                                                               Aschaffenburg   49 58           9 9
                                        *-- convert world coordinates          Augsburg        48 22           10 53
                                        *-- to plot x/y coordinates            Aurich          53 28           7 29
                                                                               Bad_Fallingbostel 52 52         9 42
                                         code......                            Bad_Segeberg    53 55           10 19
                                                                               Bayreuth        49 57           11 35
                                        *-- draw open circle above closed      Belzig          52 8            12 36
                                        *-- circle on x/y position             Berlin          52 31           13 24
                                                                               Bielefeld       52 1            8 31
                                                                               Bochum          51 29           7 13
                                         code.....                             Bonn            50 44           7 6
                                                                               Brandenburg     52 25           12 33
                                        *-- draw the name of the city, don't   Braunschweig    52 16           10 31
                                        *-- write outside the map frame

                                           code......

                                        endwhile
                                        return
                                        #!/bin/tcsh -vx
                                        set work = $HOME/DKRZcourse/GRADStest
DKRZ and M&D Introduction course 2007
                                        set bild = $work/gifs
                                        set ifile = templev.nc
                                        cd $work
                                        foreach z ( 6 ... 5720)
                                        cat > REINDA << ENDE
                                        'reinit'
                                        'set vpage 0 11 0.5 8.5'
                                        'set display color white'
                                        'clear'
                                        'run palette.joerg3.gs'
                                        'sdfopen $ifile'
                                        'set parea 1 10 1 8'
                                        'set cmin 270'
                                        'set cmax 302'
                                        'set clevs 270 273 276 279 282 285 288 291 293 296 299 302'
                                        'set ccols 37 38 39 40 41 42 43 44 45 46 47 48 49 50'
                                        'set gxout shaded'
                                        'set lev $z'                                                  set loopdim z
                                        'display thetao'                                              set lev 6 5720
                                        'run cbar.gs'                                                 set z 1 40
                                        'draw string 3 0.2 Temp from surface to bottom: $z'           display thetao
                                        'printim ./gifs/temp.$z.gif gif x600 y400 white'
                                        'quit'
                                        ENDE
                                        gradsnc -lbc 'run REINDA'
                                        rm REINDA
                                        end
                                        cd ./gifs
DKRZ and M&D Introduction course 2007
                                        foreach z ( 6 17 27 37 47 57 69 83 100 123 150 183 220 263 310 363 420 485 \
                                                    560 645 740 845 960 1085 1220 1365 1525 1700 \
                                                    1885 2080 2290 2525 2785 3070 3395 3770 4195 4670 5170 5720 )
                                        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

                                        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
DKRZ and M&D Introduction course 2007
DKRZ and M&D Introduction course 2007

                                        GrADS: infos, downloads, installations

                                         Current officially released version is GrADS 1.8s11

                                         http://www.iges.org/grads/

                                         http://www.iges.org/grads/downloads.html

                                         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
DKRZ and M&D Introduction course 2007




                                              GMT
                      generic mapping tools
DKRZ and M&D Introduction course 2007
                                           cdo outputbounds zzz.grb > zzz.asc
                                                                                sophie 25% more zzz.asc
                                        creates                                 # File = zzz.nc
                                                                                # Name = T_2M
                                                                                # Code = -1
                                                                                # Level = 2
                                                                                # Date = 1950-01-01
                                                                                # Time = 03:00
                                                                                #
                                                                                > -Z287.575
                                                                                   -10.7 34.5
                                                                                   -10.5 34.5
                                                                                   -10.5 34.7
                                                                                   -10.7 34.7
                                                                                   -10.7 34.5
                                                                                > -Z287.542
                                                                                   -10.5 34.5
                                                                                   -10.3 34.5
                                                                                   -10.3 34.7
                                                                                   -10.5 34.7
                                                                                   -10.5 34.5
                                                                                .....
DKRZ and M&D Introduction course 2007


                                        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
                                        cdo outputbounds ifile > ofile.asc
DKRZ and M&D Introduction course 2007
                                        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
                                        #!/bin/tcsh
DKRZ and M&D Introduction course 2007
                                        #
                                        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
DKRZ and M&D Introduction course 2007   #!/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
DKRZ and M&D Introduction course 2007
DKRZ and M&D Introduction course 2007

                                        gmt: infos, downloads, installations


                                        Current officially released version is gmt 4.1.4

                                        http://gmt.soest.hawaii.edu/

                                        http://gmt.soest.hawaii.edu/

                                        cross (version ?) : not installed
                                        sun solaris (version 3.41) : /client/bin
                                        LINUX (version ?) : /client/bin

				
DOCUMENT INFO