Changeset 13 for trunk/src/join_dmean_asc.pro
- Timestamp:
- 02/18/14 11:03:22 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/join_dmean_asc.pro
r8 r13 9 9 ; Join information from mean (++details) and asc (++detail) structures 10 10 ; 11 ; If station is not found in data_asc structure, latitude and longitude are set12 ; to NaN.11 ; If station is not found in data_asc structure, latitude and longitude 12 ; are set to NaN. 13 13 ; 14 14 ; :param data_dmean: structure ++details … … 25 25 ; :examples: 26 26 ; 27 ; Realistic example with POMME files: :27 ; Realistic example with POMME files: 28 28 ; 29 ; IDL> data_asc=file_asc_to_mem() 30 ; IDL> data_prn=file_prn_to_mem() 31 ; IDL> data_dmean=dmean_mld(data_prn) 32 ; IDL> data_insitu=join_dmean_asc(data_dmean,data_asc) 29 ; .. code-block:: idl 33 30 ; 34 ; impression de controle :: 31 ; data_asc = file_asc_to_mem() 32 ; data_prn = file_prn_to_mem() 33 ; data_dmean = dmean_mld(data_prn) 34 ; data_insitu = join_dmean_asc(data_dmean,data_asc) 35 35 ; 36 ; IDL> help, data_insitu, /structure 37 ; IDL> print, data_insitu[0] 38 ; IDL> print, data_insitu.lat 39 ; IDL> print, data_insitu.lon 36 ; impression de controle : 37 ; 38 ; .. code-block:: idl 39 ; 40 ; help, data_insitu, /structure 41 ; print, data_insitu[0] 42 ; print, data_insitu.lat 43 ; print, data_insitu.lon 40 44 ; 41 45 ; :uses: … … 63 67 ; 64 68 ; check doy in prn files vs computed julianday 65 ; now (20101124) differences due to either bad calculation here or bad doy calculion in .prn file or difference choice between begin, end, middle time. 69 ; now (20101124) differences due to either bad calculation here or bad 70 ; doy calculion in .prn file or difference choice between begin, end, 71 ; middle time. 66 72 ; 67 73 ; :history: … … 90 96 ;- 91 97 FUNCTION join_dmean_asc, data_dmean, data_asc 92 ;93 compile_opt idl2, strictarrsubs94 ;95 ; Return to caller if errors96 ON_ERROR, 297 ;98 usage = 'result=join_dmean_asc(data_asc,data_dmean)'99 ;100 nparam = N_PARAMS()101 IF (nparam LT 2) THEN BEGIN102 ras = report(['Incorrect number of arguments.' $103 104 105 return, -1106 ENDIF107 ;108 ; initialize returned structure109 resultstruct = { doy : 0L $110 111 112 113 114 115 116 117 118 119 120 121 122 123 ;124 ndays = n_elements(data_dmean)125 result = replicate(resultstruct, ndays)126 ;127 ; fill returned structure128 FOR iday=0L, ndays -1 DO BEGIN129 result[iday].doy=data_dmean[iday].doy130 result[iday].mean_zhom001=data_dmean[iday].mean_zhom001131 result[iday].mean_zhom002=data_dmean[iday].mean_zhom002132 result[iday].mean_zhom005=data_dmean[iday].mean_zhom005133 result[iday].mean_zhom010=data_dmean[iday].mean_zhom010134 result[iday].mean_zhomelch=data_dmean[iday].mean_zhomelch135 result[iday].std_zhom001=data_dmean[iday].std_zhom001136 result[iday].std_zhom002=data_dmean[iday].std_zhom002137 result[iday].std_zhom005=data_dmean[iday].std_zhom005138 result[iday].std_zhom010=data_dmean[iday].std_zhom010139 result[iday].std_zhomelch=data_dmean[iday].std_zhomelch140 indice_asc=WHERE(data_asc.station EQ data_dmean[iday].first_station,count)141 IF (count EQ 0) THEN BEGIN142 print, 'no station ', data_dmean[iday].first_station,' in data_asc.station'143 result[iday].lat = !VALUES.F_NAN144 result[iday].lon = !VALUES.F_NAN145 ENDIF ELSE BEGIN146 ;print, 'indice de la first_station', data_dmean[iday].first_station,' dans data_asc = ',indice_asc147 result[iday].lat = data_asc[indice_asc[0]].lat148 result[iday].lon = data_asc[indice_asc[0]].lon149 ENDELSE150 ENDFOR151 ;152 return, result153 ;98 ; 99 compile_opt idl2, strictarrsubs 100 ; 101 ; Return to caller if errors 102 ON_ERROR, 2 103 ; 104 usage = 'result = join_dmean_asc(data_asc,data_dmean)' 105 ; 106 nparam = N_PARAMS() 107 IF (nparam LT 2) THEN BEGIN 108 ras = report(['Incorrect number of arguments.' $ 109 + '!C' $ 110 + 'Usage : ' + usage]) 111 return, -1 112 ENDIF 113 ; 114 ; initialize returned structure 115 resultstruct = { doy : 0L $ 116 , lat: 0.0 $ 117 , lon: 0.0 $ 118 , mean_zhom001: 0.0 $ 119 , mean_zhom002 : 0.0 $ 120 , mean_zhom005 : 0.0 $ 121 , mean_zhom010: 0.0 $ 122 , mean_zhomelch : 0.0 $ 123 , std_zhom001: 0.0 $ 124 , std_zhom002 : 0.0 $ 125 , std_zhom005 : 0.0 $ 126 , std_zhom010: 0.0 $ 127 , std_zhomelch : 0.0 $ 128 } 129 ; 130 ndays = n_elements(data_dmean) 131 result = replicate(resultstruct, ndays) 132 ; 133 ; fill returned structure 134 FOR iday = 0L, ndays - 1 DO BEGIN 135 result[iday].doy = data_dmean[iday].doy 136 result[iday].mean_zhom001 = data_dmean[iday].mean_zhom001 137 result[iday].mean_zhom002 = data_dmean[iday].mean_zhom002 138 result[iday].mean_zhom005 = data_dmean[iday].mean_zhom005 139 result[iday].mean_zhom010 = data_dmean[iday].mean_zhom010 140 result[iday].mean_zhomelch = data_dmean[iday].mean_zhomelch 141 result[iday].std_zhom001 = data_dmean[iday].std_zhom001 142 result[iday].std_zhom002 = data_dmean[iday].std_zhom002 143 result[iday].std_zhom005 = data_dmean[iday].std_zhom005 144 result[iday].std_zhom010 = data_dmean[iday].std_zhom010 145 result[iday].std_zhomelch = data_dmean[iday].std_zhomelch 146 indice_asc = WHERE(data_asc.station EQ data_dmean[iday].first_station,count) 147 IF (count EQ 0) THEN BEGIN 148 print, 'no station ', data_dmean[iday].first_station,' in data_asc.station' 149 result[iday].lat = !VALUES.F_NAN 150 result[iday].lon = !VALUES.F_NAN 151 ENDIF ELSE BEGIN 152 ;print, 'indice de la first_station', data_dmean[iday].first_station,' dans data_asc = ',indice_asc 153 result[iday].lat = data_asc[indice_asc[0]].lat 154 result[iday].lon = data_asc[indice_asc[0]].lon 155 ENDELSE 156 ENDFOR 157 ; 158 return, result 159 ; 154 160 END
Note: See TracChangeset
for help on using the changeset viewer.