[6] | 1 | ;+ |
---|
| 2 | ; |
---|
| 3 | ; .. _cronin_gustiness_ncdf.pro: |
---|
| 4 | ; |
---|
| 5 | ; ========================= |
---|
| 6 | ; cronin_gustiness_ncdf.pro |
---|
| 7 | ; ========================= |
---|
| 8 | ; |
---|
[72] | 9 | ; Cronin gustiness correction on corrected sst on OAFLUX grid |
---|
| 10 | ; |
---|
| 11 | ; :file:`${PROJECT_OD}/TropFlux_sst_19890101_20091231.nc` have been produced by |
---|
| 12 | ; :ref:`sst_correction_ncdf.pro`. |
---|
| 13 | ; |
---|
| 14 | ; Cronin gustiness corrected ++ on corrected sst on OAFLUX grid |
---|
| 15 | ; is written in |
---|
| 16 | ; :file:`${PROJECT_OD}/TropFlux_gustiness_19890101_20091231.nc` |
---|
| 17 | ; if this file not already exists. |
---|
| 18 | ; |
---|
| 19 | ; This file will be used by :ref:`TropFlux_swr_BLND_19890101_20091231.pro` and |
---|
| 20 | ; :ref:`TropFlux_19890101_20091231.pro`. |
---|
| 21 | ; |
---|
[8] | 22 | ; .. graphviz:: |
---|
| 23 | ; |
---|
| 24 | ; digraph cronin_gustiness_ncdf { |
---|
| 25 | ; graph [ |
---|
| 26 | ; rankdir="LR", |
---|
| 27 | ; ] |
---|
[72] | 28 | ; |
---|
| 29 | ; file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_sst_19890101_20091231.nc"]; |
---|
| 30 | ; file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_gustiness_19890101_20091231.nc"]; |
---|
| 31 | ; |
---|
[8] | 32 | ; cronin_gustiness_ncdf [shape=box, |
---|
| 33 | ; fontname=Courier, |
---|
| 34 | ; color=blue, |
---|
| 35 | ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/cronin_gustiness_ncdf.pro", |
---|
[50] | 36 | ; label="${PROJECT}/src/cronin_gustiness_ncdf.pro"]; |
---|
[72] | 37 | ; |
---|
| 38 | ; {file_in} -> {cronin_gustiness_ncdf} -> {file_out} |
---|
[8] | 39 | ; } |
---|
| 40 | ; |
---|
[6] | 41 | ; EXAMPLES |
---|
| 42 | ; ======== |
---|
| 43 | ; |
---|
| 44 | ; :: |
---|
| 45 | ; |
---|
| 46 | ; IDL> cronin_gustiness_ncdf |
---|
| 47 | ; |
---|
[20] | 48 | ; SEE ALSO |
---|
| 49 | ; ======== |
---|
| 50 | ; |
---|
[72] | 51 | ; :ref:`project_profile.sh` |
---|
| 52 | ; |
---|
| 53 | ; :ref:`mooring_corrections` |
---|
| 54 | ; |
---|
| 55 | ; :ref:`sst_correction_ncdf.pro`. |
---|
| 56 | ; |
---|
[20] | 57 | ; :func:`initncdf <saxo:initncdf>` |
---|
| 58 | ; :func:`julday <saxo:julday>` |
---|
| 59 | ; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>` |
---|
| 60 | ; |
---|
[6] | 61 | ; TODO |
---|
| 62 | ; ==== |
---|
| 63 | ; |
---|
| 64 | ; coding rules |
---|
| 65 | ; |
---|
[72] | 66 | ; why writing more than 1 timestep ? |
---|
| 67 | ; |
---|
| 68 | ; KNOWN ISSUES |
---|
| 69 | ; ============ |
---|
| 70 | ; |
---|
| 71 | ; test of existence of fullfilename_in not very efficient because |
---|
| 72 | ; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented |
---|
| 73 | ; |
---|
[6] | 74 | ; EVOLUTIONS |
---|
| 75 | ; ========== |
---|
| 76 | ; |
---|
[72] | 77 | ; - fplod 20110808T144208Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 78 | ; |
---|
| 79 | ; * usage of ${PROJECT_OD} |
---|
| 80 | ; * complete description |
---|
| 81 | ; * remove v50 in output filename |
---|
| 82 | ; * remove return statement |
---|
| 83 | ; |
---|
[8] | 84 | ; - fplod 20101215T092619Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 85 | ; |
---|
| 86 | ; * add graph in header |
---|
| 87 | ; |
---|
[6] | 88 | ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
| 89 | ; |
---|
| 90 | ; * minimal header |
---|
| 91 | ; |
---|
| 92 | ; - pbk 2008 |
---|
| 93 | ; |
---|
| 94 | ; * creation |
---|
| 95 | ; |
---|
| 96 | ;- |
---|
[5] | 97 | pro cronin_gustiness_ncdf |
---|
[72] | 98 | ; |
---|
| 99 | @cm_4cal |
---|
| 100 | @cm_4data |
---|
| 101 | @cm_4mesh |
---|
| 102 | @cm_4data |
---|
| 103 | @cm_project |
---|
| 104 | ; |
---|
| 105 | ; test if ${PROJECT_OD} defined |
---|
| 106 | CASE project_od_env OF |
---|
| 107 | '' : BEGIN |
---|
| 108 | msg = 'eee : ${PROJECT_OD} is not defined' |
---|
| 109 | ras = report(msg) |
---|
| 110 | STOP |
---|
| 111 | END |
---|
| 112 | ELSE: BEGIN |
---|
| 113 | msg = 'iii : ${PROJECT_OD} is ' + project_od_env |
---|
| 114 | ras = report(msg) |
---|
| 115 | END |
---|
| 116 | ENDCASE |
---|
| 117 | ; |
---|
| 118 | ; check if output data will be possible |
---|
| 119 | iodirout = isadirectory(project_od_env) |
---|
| 120 | ; |
---|
| 121 | ; existence and protection for reading |
---|
| 122 | IF (FILE_TEST(iodirout, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN |
---|
| 123 | msg = 'eee : the directory' + iodirout + ' is not accessible.' |
---|
| 124 | ras = report(msg) |
---|
| 125 | STOP |
---|
| 126 | ENDIF |
---|
| 127 | ; |
---|
| 128 | ; existence and protection for writing |
---|
| 129 | IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN |
---|
| 130 | msg = 'eee : the directory' + iodirout + ' was not found.' |
---|
| 131 | ras = report(msg) |
---|
| 132 | STOP |
---|
| 133 | ENDIF |
---|
| 134 | ; |
---|
[5] | 135 | da1=19880101 & da2=20101231 |
---|
| 136 | date1=19890101 & date2=20081231 |
---|
[72] | 137 | ; |
---|
| 138 | ; build data filename |
---|
| 139 | filename='TropFlux_sst_19890101_20091231.nc' |
---|
| 140 | ; |
---|
| 141 | ; check if this file exists |
---|
| 142 | fullfilename = isafile(iodirout + filename, NEW=0, /MUST_EXIST) |
---|
| 143 | IF fullfilename[0] EQ '' THEN BEGIN |
---|
| 144 | msg = 'eee : the file ' + fullfilename + ' was not found.' |
---|
| 145 | ras = report(msg) |
---|
| 146 | STOP |
---|
| 147 | ENDIF |
---|
| 148 | ; |
---|
| 149 | ; build output filename |
---|
| 150 | filename_out = 'TropFlux_gustiness_19890101_20091231.nc' |
---|
| 151 | fullfilename_out = iodirout + filename_out |
---|
| 152 | ; in order to avoid unexpected overwritten |
---|
| 153 | IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN |
---|
| 154 | msg = 'eee : the file ' + fullfilename_out + ' already exists.' |
---|
| 155 | ras = report(msg) |
---|
| 156 | STOP |
---|
| 157 | ENDIF |
---|
| 158 | ; |
---|
| 159 | initncdf, fullfilename |
---|
| 160 | sst=read_ncdf('sst',da1,da2,file=fullfilename,/nostr) & sst=reform(sst-273.15) |
---|
[5] | 161 | help, sst |
---|
| 162 | |
---|
| 163 | sst_clim=grossemoyenne(sst, 't',/nan) |
---|
| 164 | ;wg=0.175*sst_clim-3.17 ;; line fit obtained from the scatter (Cronin gustiness Vs ERAI SST) |
---|
| 165 | ;help, wg |
---|
| 166 | |
---|
| 167 | jpt=n_elements(time) |
---|
| 168 | |
---|
| 169 | wg_tot=sst*0. |
---|
| 170 | for jt=0, jpt-1 do begin |
---|
| 171 | wg_tot(*,*,jt)=(((sst_clim(*,*)-23.7)*2.1/(29.8-23.7)) > 1.) <2.1 |
---|
| 172 | endfor |
---|
| 173 | help, wg_tot |
---|
| 174 | |
---|
| 175 | ;; writing field |
---|
| 176 | time=timegen(7670, units='days', start=julday(1,1,1989,0)) & jpt=n_elements(time) |
---|
| 177 | |
---|
| 178 | cda0=string(jul2date(time(0)),format='(i8.8)') |
---|
| 179 | cda1=string(jul2date(time(jpt-1)),format='(i8.8)') |
---|
| 180 | tt=time-julday(1,1,1950,00,00,00) |
---|
| 181 | xlon=reform(glamt(*,0) ) & ylat=reform(gphit(0,*)) |
---|
| 182 | |
---|
[72] | 183 | ncfile='!' + fullfilename_out |
---|
[5] | 184 | lon_attr={units:'degrees_east',long_name:'Longitude'} |
---|
| 185 | lat_attr={units:'degrees_north',long_name:'Latitude'} |
---|
| 186 | time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'} |
---|
| 187 | gust_attr={units:'m/s',missing_value:valmask,long_name:'Climatological gustiness',short_name:'wg',axis:'TYX'} |
---|
| 188 | globattr={source:'Climatological wind gustiness obtained by fitting cronins gustiness values against sst ',timerange:cda0+' - '+cda1} |
---|
| 189 | |
---|
| 190 | ncfields = 'wg[longitude,latitude,time]=wg_tot:gust_attr; ' $ |
---|
| 191 | + 'longitude[]=xlon:lon_attr; ' $ |
---|
| 192 | + 'latitude[]=ylat:lat_attr; ' $ |
---|
| 193 | + 'tt[*time]=tt:time_attr ' $ |
---|
| 194 | + ' @ globattr' |
---|
| 195 | |
---|
| 196 | @ncdf_quickwrite |
---|
| 197 | |
---|
| 198 | end |
---|