Changeset 27
- Timestamp:
- 11/29/07 12:04:29 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/procs/nc_read.pro
r10 r27 81 81 ; pour verifier si il y a une variable je fais 82 82 83 ; contient=ncdf_inquire(cdfid)84 ; for varid=0, contient.nvars-1 do BEGIN85 ; var contient=ncdf_varinq(cdfid,varid)86 ; if var contient.name eq nom then goto, variabletrouvee83 ; inq=ncdf_inquire(cdfid) 84 ; for varid=0,inq.nvars-1 do BEGIN 85 ; varinq=ncdf_varinq(cdfid,varid) 86 ; if varinq.name eq nom then goto, variabletrouvee 87 87 ; endfor 88 88 ; return, -1 … … 109 109 ; ouverture fichier netCDF + contenu 110 110 cdfid=ncdf_open(directory+file_name) 111 contient=ncdf_inquire(cdfid)111 inq=ncdf_inquire(cdfid) 112 112 ; que contient la variable 113 113 varid = ncdf_varid(cdfid, var_name) … … 123 123 return, field 124 124 ENDIF 125 var contient=ncdf_varinq(cdfid, var_name)125 varinq=ncdf_varinq(cdfid, var_name) 126 126 127 127 ; test sur la dimension 128 128 err_mess = '' 129 field_dim = n_elements(var contient.dim)129 field_dim = n_elements(varinq.dim) 130 130 131 131 ; get unlimited record variable 132 IF contient.recdim NE -1 THEN BEGIN133 ncdf_diminq, cdfid, contient.recdim, name_time, nb_time134 ;;ncdf_varget, cdfid, contient.recdim, time_array132 IF inq.recdim NE -1 THEN BEGIN 133 ncdf_diminq, cdfid, inq.recdim, name_time, nb_time 134 ;;ncdf_varget, cdfid, inq.recdim, time_array 135 135 ;;nb_time = (size(time_array))(1) 136 136 ENDIF ELSE BEGIN … … 151 151 ncdf_diminq, cdfid, dimidt, name_time, nb_time 152 152 print, 'You chose ', name_time, ' as a record dimension and its size is ', nb_time 153 contient.recdim = dimidt153 inq.recdim = dimidt 154 154 ENDIF ELSE BEGIN 155 155 print, 'No record dimension considered in the file' … … 157 157 ENDELSE 158 158 159 IF var contient.dim[varcontient.ndims-1] NE dimidt THEN STOP, $159 IF varinq.dim[varinq.ndims-1] NE dimidt THEN STOP, $ 160 160 'Post_it cannot handle variables whose record dimension is not the last one' 161 161 162 ; ncdf_diminq,cdfid,(n_elements(var contient.dim)-1), name_time, nb_time162 ; ncdf_diminq,cdfid,(n_elements(varinq.dim)-1), name_time, nb_time 163 163 ; dimidl = ncdf_dimid(cdfid, name_time) 164 164 ; ncdf_diminq,cdfid,dimidl, name_time, nb_time … … 202 202 IF debug_w THEN print, 'key_yreverse, firsty, lasty',key_yreverse, firsty, lasty 203 203 204 CASE n_elements(var contient.dim) OF204 CASE n_elements(varinq.dim) OF 205 205 206 206 ;; fichier 2d : surface … … 215 215 ;; fichier 3d : 2 cas = 1/ 2d espace + temps 2/ 3d espace 216 216 3: BEGIN 217 ;; si var contient.dim contient la dim infinie (no 3) -> temps217 ;; si varinq.dim contient la dim infinie (no 3) -> temps 218 218 dim_3 = '3d' 219 219 IF nb_time GE 1 THEN dim_3 = '2d' … … 495 495 496 496 ; scaling ? 497 FOR i = 0, var contient.natts-1 DO BEGIN497 FOR i = 0, varinq.natts-1 DO BEGIN 498 498 att_txt = ncdf_attname(cdfid, varid, i) 499 499 IF att_txt EQ 'scale_factor' THEN BEGIN … … 511 511 ; get long name 512 512 ; result = '???' 513 FOR i = 0, var contient.natts-1 DO BEGIN513 FOR i = 0, varinq.natts-1 DO BEGIN 514 514 att_txt = ncdf_attname(cdfid, varid, i) 515 515 IF att_txt EQ 'long_name' OR att_txt EQ 'title' THEN ncdf_attget, cdfid, varid, att_txt, result … … 533 533 534 534 valmask = 1.e20 535 FOR i = 0, var contient.natts-1 DO BEGIN535 FOR i = 0, varinq.natts-1 DO BEGIN 536 536 att_txt = ncdf_attname(cdfid, varid, i) 537 537 IF att_txt EQ 'missing_value' OR att_txt EQ 'mask value' OR att_txt EQ '_FillValue' THEN ncdf_attget, cdfid, varid, att_txt, valmask
Note: See TracChangeset
for help on using the changeset viewer.