Changeset 275


Ignore:
Timestamp:
09/03/07 15:59:09 (17 years ago)
Author:
smasson
Message:

reduce memory use

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/ToBeReviewed/LECTURE/read_ncdf.pro

    r271 r275  
    324324    valmask = 1.e20 
    325325    case 1 of 
    326       varinq.ndims eq 2:BEGIN ;xy array 
    327         earth = where(mask[*, *, 0] EQ 0) 
    328       END 
    329       varinq.ndims eq 3 AND (where(varinq.dim EQ inq.recdim))[0] EQ -1:BEGIN ;xyz array 
    330         earth = where(mask EQ 0) 
    331       END 
    332       varinq.ndims eq 3 AND (where(varinq.dim EQ inq.recdim))[0] NE -1:BEGIN ;xyt array     
    333         earth = where(mask[*, *, 0] EQ 0) 
    334         if earth[0] NE -1 then BEGIN 
    335           earth = earth#replicate(1, jpt)+replicate(nx*ny, n_elements(earth))#lindgen(jpt) 
    336         END 
    337       END 
    338       varinq.ndims eq 4:BEGIN ;xyzt array 
    339         earth = where(mask EQ 0) 
    340         if earth[0] NE -1 then BEGIN 
    341           earth = earth#replicate(1, jpt)+replicate(nx*ny*nz, n_elements(earth))#lindgen(jpt) 
    342         END 
    343       END 
     326      varinq.ndims eq 2:                                               earth = where(mask[*, *, 0] EQ 0) ;xy   array 
     327      varinq.ndims eq 3 AND (where(varinq.dim EQ inq.recdim))[0] EQ -1:earth = where(mask EQ 0)          ;xyz  array 
     328      varinq.ndims eq 3 AND (where(varinq.dim EQ inq.recdim))[0] NE -1:earth = where(mask[*, *, 0] EQ 0) ;xyt  array     
     329      varinq.ndims eq 4:                                               earth = where(mask EQ 0)          ;xyzt array 
    344330    ENDCASE 
    345331  ENDIF ELSE earth = -1 
     
    347333; we apply add_offset, scale_factor and missing_value 
    348334  IF keyword_set(addscl_before) THEN BEGIN 
    349     if scale_factor NE 1 then res = temporary(res)*scale_factor 
    350     if add_offset NE 0 then res = temporary(res)+add_offset 
    351   ENDIF 
    352   IF size(missing_value, /type) NE 7 then BEGIN 
     335    IF scale_factor NE 1 THEN res = temporary(res)*scale_factor 
     336    IF add_offset   NE 0 THEN res = temporary(res)+add_offset 
     337  ENDIF 
     338  IF size(missing_value, /type) NE 7 THEN BEGIN 
    353339    IF finite(missing_value) EQ 1 THEN BEGIN 
    354340        CASE 1 OF 
     
    364350    if add_offset NE 0 then res = temporary(res)+add_offset 
    365351  ENDIF 
    366   if missing[0] NE -1 then res[temporary(missing)] = !values.f_nan 
    367   if earth[0] NE -1 then res[temporary(earth)] = 1.e20 
     352  IF missing[0] NE -1 THEN res[temporary(missing)] = !values.f_nan 
     353  IF earth[0] NE -1 THEN BEGIN  
     354    IF varinq.ndims eq 3 AND (where(varinq.dim EQ inq.recdim))[0] NE -1 THEN $   ;xyt array     
     355       earth = earth#replicate(1, jpt)+replicate(nx*ny, n_elements(earth))#lindgen(jpt) 
     356    IF varinq.ndims eq 4 THEN earth = earth#replicate(1, jpt)+replicate(nx*ny*nz, n_elements(earth))#lindgen(jpt) 
     357    res[temporary(earth)] = 1.e20 
     358  ENDIF  
    368359;--------------------------------------------------------------------- 
    369360; if it is roms outputs, we need to get additionals infos... 
Note: See TracChangeset for help on using the changeset viewer.