- Timestamp:
- 12/17/10 11:00:48 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/oaflux_mask_30N30S.pro
r15 r17 7 7 ; ====================== 8 8 ; 9 ; Produce a NetCDF file with OAFLUX mask over global tropical oceans 10 ; 9 11 ; .. graphviz:: 10 12 ; … … 13 15 ; rankdir="LR", 14 16 ; ] 15 ; file_oaflux [shape=ellipse,fontname=Courier,label=" /Volumes/vialardj/OAFLUX/lh_oaflux_2004.nc"];16 ; mask [shape=ellipse,fontname=Courier,label=" /Users/jv/data/OAFLUX/mask_oaflux_30N30S.nc"];17 ; file_oaflux [shape=ellipse,fontname=Courier,label="${TROPFLUX_ID}/lh_oaflux_2004.nc"]; 18 ; mask [shape=ellipse,fontname=Courier,label="${TROPFLUX_OD}/mask_oaflux_30N30S.nc"]; 17 19 ; 18 20 ; oaflux_mask_30N30S [shape=box, … … 31 33 ; :ref:`guide data OAFLUX <data_in_oaflux>` 32 34 ; 35 ; :ref:`tropflux_profile.sh` 36 ; 37 ; :func:`report` 38 ; :func:`initncdf` 39 ; :func:`ncdf_lec` 40 ; :ref:`ncdf_quickwrite` 41 ; :func:`isadirectory` 42 ; 33 43 ; EXAMPLES 34 44 ; ======== … … 41 51 ; ==== 42 52 ; 43 ; hard coded directory - usage of ${TROPFLUX_ID}53 ; SAXO new (keep compatibility false) 44 54 ; 45 55 ; coding rules 46 56 ; 57 ; pro -> function 58 ; 59 ; NetCDF CF (may be area_type) 60 ; 61 ; global attributes corrections : 62 ; - written now : OAFLUX mask over the Indian Ocean: 40E-120E, 30S-30N 63 ; - while data latitude=[-29.5,+29.5] longitude=[30.5,379.5] 64 ; 65 ; KNOWN ISSUES 66 ; ============ 67 ; 68 ; test of existence of fullfilename_in not very efficient because 69 ; MUST_EXIST keyword of :func:`isafile` not yet implemented 70 ; 47 71 ; EVOLUTIONS 48 72 ; ========== 73 ; 74 ; - fplod 20101217T081915Z aedon.locean-ipsl.upmc.fr (Darwin) 75 ; 76 ; * remove hard coded directory - usage of ${TROPFLUX_ID} and ${TROPFLUX_OD} 77 ; * add IO test 49 78 ; 50 79 ; - fplod 20101216T141137Z aedon.locean-ipsl.upmc.fr (Darwin) … … 59 88 ; 60 89 PRO oaflux_mask_30N30S 61 90 ; 62 91 @common 63 64 92 ; 65 ; ; Read oaflux grid and mask93 ; check for input file 66 94 ; 67 dir='/Volumes/vialardj/OAFLUX/' 68 dir='/Users/jv/data/OAFLUX/' 69 70 yy=2004 & cy=string(yy,format='(i4.4)') 71 fi=dir+'lh_oaflux_'+cy+'.nc' 72 initncdf, fi 73 lh=ncdf_lec(fi,var='lhtfl',count=[jpi,jpj,1]) & lh=float(lh) 95 ; test if ${TROPFLUX_ID} defined 96 tropflux_id_env=GETENV('TROPFLUX_ID') 97 CASE tropflux_id_env OF 98 '' : BEGIN 99 msg = 'eee : ${TROPFLUX_ID} is not defined' 100 ras = report(msg) 101 STOP 102 END 103 ELSE: BEGIN 104 msg = 'iii : ${TROPFLUX_ID} is ' + tropflux_id_env 105 ras = report(msg) 106 END 107 ENDCASE 108 ; 109 iodirin = isadirectory(tropflux_id_env) 110 ; 111 ; existence and protection of ${TROPFLUX_ID} 112 IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN 113 msg = 'eee : the directory' + iodirin + ' is not accessible.' 114 ras = report(msg) 115 STOP 116 ENDIF 117 ; 118 ; build input filename 119 yyyy=2004 120 cy=string(yyyy,format='(i4.4)') 121 filename_in='lh_oaflux_'+cy+'.nc' 122 ; 123 ; check if this file exists 124 fullfilename_in = isafile(iodirin + filename_in, NEW=0, /MUST_EXIST) 125 IF fullfilename_in[0] EQ '' THEN BEGIN 126 msg = 'eee : the file ' + fullfilename_in + ' was not found.' 127 ras = report(msg) 128 STOP 129 ENDIF 130 ; 131 ; test if ${TROPFLUX_OD} defined 132 tropflux_od_env=GETENV('TROPFLUX_OD') 133 CASE tropflux_od_env OF 134 '' : BEGIN 135 msg = 'eee : ${TROPFLUX_OD} is not defined' 136 ras = report(msg) 137 STOP 138 END 139 ELSE: BEGIN 140 msg = 'iii : ${TROPFLUX_OD} is ' + tropflux_od_env 141 ras = report(msg) 142 END 143 ENDCASE 144 ; 145 ; check if output data will be possible 146 iodirout = isadirectory(tropflux_od_env) 147 ; 148 ; existence and protection 149 IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN 150 msg = 'eee : the directory' + iodirout + ' was not found.' 151 ras = report(msg) 152 STOP 153 ENDIF 154 ; 155 fullfilename_out=iodirout+'mask_oaflux_30N30S.nc' 156 ; in order to avoid unexpected overwritten 157 IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN 158 msg = 'eee : the file ' + fullfilename_out + ' already exists.' 159 ras = report(msg) 160 STOP 161 ENDIF 162 ; 163 ; Read oaflux grid and mask 164 initncdf, fullfilename_in 165 lh=ncdf_lec(fullfilename_in,var='lhtfl',count=[jpi,jpj,1]) & lh=float(lh) 74 166 valmask=1.e20 75 167 ind=where(lh ge 32000,compl=nind) & lh(ind)=valmask & lh(nind)=-0.1*lh(nind) … … 88 180 89 181 90 ncfile='!'+ dir+'mask_oaflux_30N30S.nc'182 ncfile='!'+fullfilename_out 91 183 lon_attr={units:'degrees_east',long_name:'Longitude'} 92 184 lat_attr={units:'degrees_north',long_name:'Latitude'}
Note: See TracChangeset
for help on using the changeset viewer.