Ignore:
Timestamp:
08/08/11 17:08:15 (13 years ago)
Author:
pinsard
Message:

start to work on correction tools

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lwr_correction_ncdf.pro

    r50 r72  
    66; lwr_correction_ncdf.pro 
    77; ======================= 
     8; 
     9; Correction of lwr on OAFLUX grid 
     10; 
     11; :file:`${PROJECT_OD}/erai_lwr_19890101_20091231_oafluxgrid.nc` have been 
     12; produced by :ref:`interp_erai_lwr_1989_2009.pro`. 
     13; 
     14; Corrected lwr on OAFLUX grid is written in 
     15; :file:`${PROJECT_OD}/TropFlux_lwr_19890101_20091231.nc` 
     16; if this file not already exists. 
     17; 
     18; This file will be used by :ref:`TropFlux_19890101_20091231.pro`. 
    819; 
    920;     .. graphviz:: 
     
    1425;           ] 
    1526; 
    16 ;           file_in [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_lwr_19890102_20091231_oafluxgrid.nc"]; 
    17 ; 
    18 ;           ncfile [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_cor/full_cor/TropFlux_lwr_19890101_20091231_v1.nc"]; 
     27;           file_in [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_lwr_19890101_20091231_oafluxgrid.nc"]; 
     28;           file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/TropFlux_lwr_19890101_20091231.nc"]; 
     29; 
    1930;           lwr_correction_ncdf [shape=box, 
    2031;           fontname=Courier, 
     
    2334;           label="${PROJECT}/src/lwr_correction_ncdf.pro"]; 
    2435; 
    25 ;           {file_in} -> {lwr_correction_ncdf} -> {ncfile} 
     36;           {file_in} -> {lwr_correction_ncdf} -> {file_out} 
    2637; 
    2738;        } 
     
    2940; SEE ALSO 
    3041; ======== 
     42; 
     43; :ref:`project_profile.sh` 
     44; 
     45; :ref:`mooring_corrections` 
     46; 
     47; :ref:`interp_erai_lwr_1989_2009.pro` 
    3148; 
    3249; :func:`initncdf <saxo:initncdf>` 
     
    4461;  IDL> lwr_correction_ncdf 
    4562; 
    46 ; 
    4763; TODO 
    4864; ==== 
    4965; 
    50 ; hard coded directory - usage of ${PROJECT_ID} 
    51 ; 
    5266; coding rules 
     67; 
     68; lwr long name 'Air Temperature at 2m" : ??? 
     69; 
     70; 19890101 is not provided in ERA-Intermim file str : a possible workaround is 
     71; to copy 19890102 
     72; dataset to 19890101 using nco before processing. see 
     73; ref:`compute_erai_daily_region_2d.sh` 
     74; 
     75; here I (fp) replace hard coded date 19890102 by 19890101. must check 
     76; consistency with this module and interp_erai_lwr_1989_2009.pro. 
     77; 
     78; KNOWN ISSUES 
     79; ============ 
     80; 
     81; test of existence of fullfilename_in not very efficient because 
     82; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented 
    5383; 
    5484; EVOLUTIONS 
    5585; ========== 
    5686; 
     87; - fplod 20110808T120234Z cratos (Linux) 
     88; 
     89;   * usage of ${PROJECT_OD} 
     90;   * complete description 
     91;   * replace erai_lwr_19890102_20091231_oafluxgrid.nc by erai_lwr_19890101_20091231 
     92;   * remove v1 in output filename 
     93; 
    5794; - fplod 20101215T113707Z aedon.locean-ipsl.upmc.fr (Darwin) 
    5895; 
     
    69106;- 
    70107pro lwr_correction_ncdf 
    71 @common 
     108; 
     109@cm_4cal 
     110@cm_4data 
     111@cm_4mesh 
     112@cm_4data 
     113@cm_project 
     114; 
     115; test if ${PROJECT_OD} defined 
     116CASE project_od_env OF 
     117  '' : BEGIN 
     118         msg = 'eee : ${PROJECT_OD} is not defined' 
     119         ras = report(msg) 
     120       STOP 
     121       END 
     122  ELSE: BEGIN 
     123          msg = 'iii : ${PROJECT_OD} is ' + project_od_env 
     124          ras = report(msg) 
     125        END 
     126 ENDCASE 
     127; 
     128; check if output data will be possible 
     129iodirout = isadirectory(project_od_env) 
     130; 
     131; existence and protection for reading 
     132IF (FILE_TEST(iodirout, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN 
     133   msg = 'eee : the directory' + iodirout  + ' is not accessible.' 
     134   ras = report(msg) 
     135   STOP 
     136ENDIF 
     137; 
     138; existence and protection for writing 
     139IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN 
     140    msg = 'eee : the directory' + iodirout  + ' was not found.' 
     141    ras = report(msg) 
     142    STOP 
     143ENDIF 
     144; 
    72145da1=19880101 & da2=20091231 
    73  
    74 file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_lwr_19890102_20091231_oafluxgrid.nc' 
    75 initncdf, file 
    76 lwr=read_ncdf('lwr',da1,da2,file=file,/nostr) 
     146; 
     147; build data filename 
     148filename='erai_lwr_19890101_20091231_oafluxgrid.nc' 
     149; 
     150; check if this file exists 
     151fullfilename = isafile(iodirout + filename, NEW=0, /MUST_EXIST) 
     152IF fullfilename[0] EQ '' THEN BEGIN 
     153   msg = 'eee : the file ' + fullfilename + ' was not found.' 
     154   ras = report(msg) 
     155   STOP 
     156ENDIF 
     157; 
     158; build output filename 
     159filename_out = 'TropFlux_lwr_19890101_20091231.nc' 
     160fullfilename_out = iodirout + filename_out 
     161; in order to avoid unexpected overwritten 
     162IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN 
     163   msg = 'eee : the file ' + fullfilename_out  + ' already exists.' 
     164   ras = report(msg) 
     165   STOP 
     166ENDIF 
     167; 
     168initncdf, fullfilename 
     169lwr=read_ncdf('lwr',da1,da2,file=fullfilename,/nostr) 
    77170help, lwr 
    78  
     171; 
    79172lwr_mean=grossemoyenne(lwr,'t',/nan) 
    80173help,lwr_mean 
     
    116209time=time-julday(1,1,1950) & jpt=n_elements(time) 
    117210 
    118 ncfile='!/Volumes/PRAVEEN/TropFlux/input_cor/full_cor/TropFlux_lwr_19890101_20091231_v1.nc' 
     211ncfile='!' + fullfilename_out 
    119212lon_attr={units:'degrees_east',long_name:'Longitude'} 
    120213lat_attr={units:'degrees_north',long_name:'Latitude'} 
     
    123216globattr={source:'Basic data obtained from ERAI.  Mean correction for  bias and correction for variability are applied',timerange:cda0+' - '+cda1} 
    124217 
    125  
    126218ncfields = 'lwr[longitude,latitude,time]=lwr_new:lwr_attr; ' $ 
    127219                      + 'longitude[]=lon:lon_attr; ' $ 
Note: See TracChangeset for help on using the changeset viewer.