Changeset 542


Ignore:
Timestamp:
04/30/12 12:49:45 (12 years ago)
Author:
pinsard
Message:

fix some time issue in netcdf writing tool

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/idl_amsu_netcdf.pro

    r532 r542  
    4343; ======== 
    4444; 
    45 ; To produce :file:`${PROJECT_OD}/AMSU/a5_20060801_20060812_01000w2000n_00100w3000n.nc`:: 
     45; To produce 
     46; :file:`${PROJECT_OD}/AMSU/a5_20060801_20060812_01000w2000n_00100w3000n.nc`:: 
    4647; 
    4748;    numch = 'a5' 
     
    5253;    idl_amsu_netcdf, numch , datain, lats, lons, timesin 
    5354; 
     55; TIPS 
     56; ==== 
     57; 
     58; File produced by can be read using :func:`read_ncdf <saxo:read_ncdf>` :: 
     59; 
     60;  tb=read_ncdf('moyenne_tb', 20060801, 20060802, file='/homedata/pinsard/varamma_d/AMSU/a5mrt0.5rh1.0_20060801_20060804_02400w0400s_02400e1900n.nc') 
     61; 
    5462; SEE ALSO 
    5563; ======== 
     
    6573; 
    6674; 
     75; ++ test si toutes les valeurs sont des valeurs manquantes/aberantes 
     76; si ou ne rien écrire 
     77; 
     78; improve tip 
     79; 
    6780; check arg : time in julian days. check for noon !! 
    6881; 
     
    8598; 
    8699; $URL$ 
     100; 
     101; - fplod 20120430 
     102; 
     103;   * time unlimited 
     104;   * time origine is a ttribute of time not of tb 
     105;   * fix double vs fltarr 
     106;   * fix missing value 
     107; 
     108;   nb : now cdo showdate and showtime work 
    87109; 
    88110; - lelod 20120410 
     
    134156; 
    135157;- 
    136 pro idl_amsu_netcdf, numch, temp,rtemp,rhdeg, datain, lats, lons, timesin 
     158pro idl_amsu_netcdf, numch, temp, rtemp, rhdeg, datain, lats, lons, timesin 
    137159; 
    138160compile_opt idl2, strictarrsubs 
     
    149171rt=string(rtemp,format='(f3.1)') 
    150172rh=string(rhdeg,format='(f3.1)') 
    151 prefix = numch + temp + 'rt'+rt+'rh'+rh +'_' 
    152  
     173prefix = numch + temp + 'rt' + rt + 'rh' + rh + '_' 
     174; 
    153175look = 'filename' 
    154176scale = 100. 
     
    166188        + '.nc' 
    167189; 
    168 ; definition des tableaux qui vont contenir les valeurs des fichiers ascii 
     190; definition des tableaux qui vont contenir les valeurs à écrire 
     191; dans les fichiers NetCDF 
    169192moyenne_tb = fltarr(nblon, nblat, nbtime) 
    170193xlon = fltarr(nblon) 
     
    184207print,"nb valeurs manquantes", nnbad 
    185208; 
     209; ++ test si toutes les valeurs sont des valeurs manquantes/aberantes 
     210; si ou ne rien écrire 
     211; 
    186212; 
    187213;--------------------------------------- 
     
    197223print, 'ouverture pour ecriture de ', cdfout 
    198224id = ncdf_create(cdfout,/clobber) 
    199 ;++ncdf_control, id, /nofill 
     225ncdf_control, id, /nofill 
     226; 
    200227; dimension 
    201228dimidx = ncdf_dimdef(id, 'xlon', nblon) 
    202229dimidy = ncdf_dimdef(id, 'ylat', nblat) 
    203 dimidt = ncdf_dimdef(id, 'time', nbtime) 
     230dimidt = ncdf_dimdef(id, 'time', /UNLIMITED) 
    204231; 
    205232; attributs globaux 
     
    209236creation_date = string(jul2date(SYSTIME(/JULIAN, /UTC )), format='(I8)') 
    210237ncdf_attput, id, 'Creation_date', creation_date, /GLOBAL 
    211 ;print,creation_date 
     238;print, creation_date 
    212239; 
    213240; declaration des variables 
    214241varid = lonarr(4) 
    215 varid[0] = ncdf_vardef(id, 'xlon', [dimidx], /double) 
    216 varid[1] = ncdf_vardef(id, 'ylat', [dimidy], /double) 
    217 varid[2] = ncdf_vardef(id, 'time', [dimidt], /double) 
     242varid[0] = ncdf_vardef(id, 'xlon', [dimidx], /float) 
     243varid[1] = ncdf_vardef(id, 'ylat', [dimidy], /float) 
     244varid[2] = ncdf_vardef(id, 'time', [dimidt], /float) 
    218245varid[3] = ncdf_vardef(id, 'moyenne_tb',[dimidx,dimidy,dimidt], /float) 
    219246; 
     
    221248ncdf_attput, id, varid[0], 'units', 'degrees_east' 
    222249ncdf_attput, id, varid[0], 'title', 'Longitude' 
     250; 
    223251ncdf_attput, id, varid[1], 'units', 'degrees_north' 
    224252ncdf_attput, id, varid[1], 'title', 'Latitude' 
     253; 
    225254ncdf_attput, id, varid[2], 'units', 'days since 2000-01-01 00:00:00' 
    226 ncdf_attput, id, varid[2], 'long_name', 'Time axis' 
    227 ncdf_attput, id, varid[3], 'time_origin', '2000-01-01 00:00:00' 
     255ncdf_attput, id, varid[2], 'long_name', 'time' 
     256ncdf_attput, id, varid[2], 'short_name', 'time' 
     257ncdf_attput, id, varid[2], 'axis', 'T' 
     258ncdf_attput, id, varid[2], 'time_origin', '2000-01-01 00:00:00' 
     259; 
    228260ncdf_attput, id, varid[3], 'short_name', 'amsu_tb' 
    229 ncdf_attput, id, varid[3], 'missing_value', '-9999.00' 
     261ncdf_attput, id, varid[3], 'missing_value', -9999.00 
    230262ncdf_attput, id, varid[3], 'unit', 'degree_kelvin' 
    231263; 
Note: See TracChangeset for help on using the changeset viewer.