Changeset 509


Ignore:
Timestamp:
12/19/19 10:27:05 (5 years ago)
Author:
smasson
Message:

commit old minor bugfix

Location:
trunk/SRC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Interpolation/compute_fromirr_bilinear_weigaddr.pro

    r495 r509  
    6464;- 
    6565PRO compute_fromirr_bilinear_weigaddr, olonin, olat, omsk, alonin, alat, amsk $ 
    66                                      , weig, addr 
     66                                     , weig, addr, lonref1 = lonref1, onplane = onplane, notuse_neighbor = notuse_neighbor 
    6767; 
    6868  compile_opt idl2, strictarrsubs 
     
    7676  jpio = (size(olonin, /dimensions))[0] 
    7777  jpjo = (size(olonin, /dimensions))[1] 
     78; 
    7879; mask check 
    7980  IF n_elements(omsk) EQ 1 AND omsk[0] EQ -1 THEN BEGIN 
     
    114115  ENDELSE 
    115116; 
     117  IF n_elements(lonref1) EQ 0 THEN lonref1 = 0. 
     118  lonref2 = lonref1 + 360. 
    116119; longitude, between 0 and 360 
    117   alon = alonin MOD 360 
    118   out = where(alon LT 0) 
    119   IF out[0] NE -1 THEN alon[out] = alon[out]+360 
    120   olon = olonin MOD 360 
    121   out = where(olon LT 0) 
    122   IF out[0] NE -1 THEN olon[out] = olon[out]+360 
     120  alon = (alonin + 720. ) MOD 360. 
     121; longitude, between lonref1 and lonref2 
     122  out = where(alon LT lonref1) 
     123  IF out[0] NE -1 THEN alon[out] = alon[out] + 360. 
     124  out = where(alon GT lonref2) 
     125  IF out[0] NE -1 THEN alon[out] = alon[out] - 360. 
     126; longitude, between 0 and 360 
     127  olon = ( olonin + 720. ) MOD 360. 
     128; longitude, between lonref1 and lonref2 
     129  out = where(olon LT lonref1) 
     130  IF out[0] NE -1 THEN olon[out] = olon[out] + 360. 
     131  out = where(olon GT lonref2) 
     132  IF out[0] NE -1 THEN olon[out] = olon[out] - 360. 
    123133; 
    124134; we work only on the output grid water points 
     
    168178; 
    169179  delta = max([(360./jpio), (180./jpjo)])* 3. 
     180  print,  routine, ' total loop length = ' , nawater 
    170181  FOR n = 0L, nawater-1 DO BEGIN 
    171182; control print 
     
    184195      END 
    185196; if we are near the longitude periodicity area 
    186       xx LE delta OR xx GE (360-delta):BEGIN 
     197      xx LE (lonref1+delta) OR xx GE (lonref2-delta):BEGIN 
    187198        lat1 = yy-delta 
    188199        lat2 = yy+delta 
    189         good = where((minxcell LE 2*delta OR maxxcell GE (360-2*delta)) AND maxycell GE lat1 AND minycell LE lat2) 
     200        good = where((minxcell LE (lonref1+2*delta) OR maxxcell GE (lonref2-2*delta)) AND maxycell GE lat1 AND minycell LE lat2) 
    190201        onsphere = 1 
    191202      END 
     
    203214          (jpio EQ 720  OR jpio EQ 722 ) AND (jpjo EQ 522  OR jpjo EQ 521  OR jpjo EQ 520 ):onsphere = yy GT 40 
    204215          (jpio EQ 1440 OR jpio EQ 1442) AND (jpjo EQ 1021 OR jpjo EQ 1020 OR jpjo EQ 1019):onsphere = yy GT 40 
    205           ELSE:onsphere = 1 
     216          ELSE:onsphere = 1 - keyword_set(onplane)  
    206217        ENDCASE 
    207218      END 
     
    264275        ENDCASE 
    265276      ENDIF ELSE foraddr[n] = -1 
    266     ENDIF ELSE foraddr[n] = -1 
     277    ENDIF ELSE foraddr[n] =  -1 
    267278  ENDFOR 
     279   
     280  IF keyword_set(notuse_neighbor) THEN BEGIN  ; don't do anything for bad points -> they will have no addr/weig like land points 
     281    ok = where(foraddr NE -1, nawater)   ; keep only the points that are above a water oceanic cell. 
     282    foraddr = foraddr[ok] 
     283    forweight = forweight[ok, *] 
     284    awater = awater[temporary(ok)] 
     285  ENDIF 
     286   
    268287; do we have some water atmospheric points that are not located in an water oceanic cell? 
    269288  bad = where(foraddr EQ -1) 
     
    281300    neig = lonarr(n_elements(bad)) 
    282301    onsphere = 1 
     302    print,  routine, ' total loop length = ', n_elements(bad) 
    283303    FOR i = 0L, n_elements(bad)-1L DO BEGIN 
    284304      IF (i MOD 500) EQ 0 THEN print, routine, ' i = ', i 
     
    289309        ytmp GE (90-delta):keep = where(goodlat GE 90-3*delta, cnt) 
    290310; if we are near the longitude periodicity area 
    291         xtmp LE delta OR xtmp GE (360-delta):keep = where((goodlon LE 3*delta OR goodlon GE (360-3*delta)) $ 
     311        xtmp LE (lonref1+delta) OR xtmp GE (lonref2-delta):keep = where((goodlon LE (lonref1+3*delta) OR goodlon GE (lonref2-3*delta)) $ 
    292312                                                          AND goodlat GE (ytmp-3*delta) AND goodlat LE (ytmp+3*delta), cnt) 
    293313; other cases 
  • trunk/SRC/ToBeReviewed/PLOTS/DIVERS/placecolor.pro

    r495 r509  
    3939; 
    4040;- 
    41 PRO placecolor, pos, _EXTRA=ex 
     41PRO placecolor, pos, _EXTRA = ex 
    4242; 
    4343  compile_opt idl2, strictarrsubs 
    4444; 
    4545@cm_4ps 
    46    IF NOT keyword_set(key_forgetold) THEN BEGIN 
     46  IF NOT keyword_set(key_forgetold) THEN BEGIN 
    4747@updatenew 
    48    ENDIF 
     48  ENDIF 
    4949; 
    50    xsave = !x 
    51    ysave = !y 
    52    psave = !p 
     50  xsave = !x 
     51  ysave = !y 
     52  psave = !p 
    5353; 
    54    reinitplt, /z, /invert 
    55    pos=1.*pos 
    56    mipgsz = min(page_size, max = mapgsz) 
    57    if key_portrait eq 1 then begin 
    58       pos[0]=pos[0]/mipgsz 
    59       pos[1]=pos[1]/mapgsz 
    60       pos[2]=pos[2]/mipgsz 
    61       pos[3]=pos[3]/mapgsz 
    62    endif else begin 
    63       pos[0]=pos[0]/mapgsz 
    64       pos[1]=pos[1]/mipgsz 
    65       pos[2]=pos[2]/mapgsz 
    66       pos[3]=pos[3]/mipgsz 
    67    ENDELSE 
     54  reinitplt, /z, /invert 
     55  pos = 1.*pos 
     56  mipgsz = min(page_size, max = mapgsz) 
     57  if key_portrait eq 1 then begin 
     58    pos[0] = pos[0]/mipgsz 
     59    pos[1] = pos[1]/mapgsz 
     60    pos[2] = pos[2]/mipgsz 
     61    pos[3] = pos[3]/mapgsz 
     62  endif else begin 
     63    pos[0] = pos[0]/mapgsz 
     64    pos[1] = pos[1]/mipgsz 
     65    pos[2] = pos[2]/mapgsz 
     66    pos[3] = pos[3]/mipgsz 
     67  ENDELSE 
    6868; 
    69    def_myuniquetmpdir 
     69  def_myuniquetmpdir 
    7070; 
    71    IF lmgr(/demo) EQ 1 THEN BEGIN 
     71  IF lmgr(/demo) EQ 1 THEN BEGIN 
    7272; if we are in demo mode, we cannot save the parameters in a temporary file... 
    7373@cm_demomode_used 
    7474; 
    75       colnumb = colorbarparam.colnumb 
    76       clbinf = colorbarparam.clbinf 
    77       clbsup = colorbarparam.clbsup 
    78       clbdiv = colorbarparam.clbdiv 
     75    colnumb = colorbarparam.colnumb 
     76    clbinf = colorbarparam.clbinf 
     77    clbsup = colorbarparam.clbsup 
     78    clbdiv = colorbarparam.clbdiv 
    7979; 
    80    ENDIF ELSE BEGIN 
    81       file = myuniquetmpdir + '4colorbar.dat' 
    82       IF file_test(file) THEN BEGIN 
    83          restore, file 
    84          if size(ex, /type) EQ 8 then BEGIN 
    85             if (where(tag_names(ex) EQ 'MIN'))[0] NE -1 then clbinf = ex.MIN 
    86             if (where(tag_names(ex) EQ 'MAX'))[0] NE -1 then clbsup = ex.MAX 
    87             if (where(tag_names(ex) EQ 'DIVISIONS'))[0] NE -1 then clbdiv = ex.DIVISIONS 
    88          ENDIF 
     80  ENDIF ELSE BEGIN 
     81    file = myuniquetmpdir + '4colorbar.dat' 
     82    IF file_test(file) THEN BEGIN 
     83      restore, file 
     84      if size(ex, /type) EQ 8 then BEGIN 
     85        if (where(tag_names(ex) EQ 'MIN'))[0] NE -1 then clbinf = ex.MIN 
     86        if (where(tag_names(ex) EQ 'MAX'))[0] NE -1 then clbsup = ex.MAX 
     87        if (where(tag_names(ex) EQ 'DIVISIONS'))[0] NE -1 then clbdiv = ex.DIVISIONS 
     88      ENDIF 
     89    ENDIF 
    8990; 
    90          COLORBAR, COLOR = 0, DIVISIONS = clbdiv, DISCRET = colnumb $ 
    91           , cb_color = 0, POSITION = pos, MAX = clbsup $ 
    92           , MIN = clbinf, cb_charsize = !p.charsize $ 
    93           , _extra = ex 
    94       ENDIF 
    95    ENDELSE 
     91    COLORBAR, COLOR = 0, DIVISIONS = clbdiv, DISCRET = colnumb $ 
     92              , cb_color = 0, POSITION = pos, MAX = clbsup $ 
     93              , MIN = clbinf, cb_charsize = !p.charsize $ 
     94              , _extra = ex 
     95  ENDELSE 
    9696; 
    97    !x = xsave 
    98    !y = ysave 
    99    !p = psave 
     97  !x = xsave 
     98  !y = ysave 
     99  !p = psave 
    100100; 
    101    return 
     101  return 
    102102end 
Note: See TracChangeset for help on using the changeset viewer.