Changeset 526 in lmdz_wrf
- Timestamp:
- Jun 22, 2015, 1:12:48 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/validation_sim.py
r525 r526 1940 1940 for kst in range(Nstsim): 1941 1941 timedn = prestdescsim[kst] + 'time' 1942 print ' ' + prestdescsim[kst] + ' ...' 1942 1943 1943 1944 if stdescsim[kst] == 'E': … … 1947 1948 ovobs, exacttvalues, oFillValue, Ngrid, 'instantaneous') 1948 1949 1949 vname = prestdescsim[kst] + 'time' 1950 1951 newvar = onewnc.createVariable(vname,'f8', (timedn)) 1952 basicvardef(newvar, vname, 'exact coincident time observations and ' + \ 1953 'simulation', obstunits) 1954 set_attribute(newvar, 'calendar', 'standard') 1955 newvar[:] = exacttvalues[:,3] 1956 1957 elif == stdescsim[kst] == 'C': 1950 if ivar == 0: 1951 vname = prestdescsim[kst] + 'time' 1952 newvar = onewnc.createVariable(vname,'f8', (timedn)) 1953 basicvardef(newvar, vname, 'exact coincident time observations and '+\ 1954 'simulation', obstunits) 1955 set_attribute(newvar, 'calendar', 'standard') 1956 newvar[:] = exacttvalues[:,3] 1957 1958 dimt = Nexactt 1959 1960 elif stdescsim[kst] == 'C': 1958 1961 # Simualted closest to Observed times 1959 1962 simobsvalues, simobsSvalues, simobsTtvalues, trjsim = \ 1960 1963 getting_ValidationValues(obskind, Nclosest, dims, trajpos, ovsim, \ 1961 1964 ovobs, closesttvalues, oFillValue, Ngrid, 'instantaneous') 1962 1963 vname = prestdescsim[kst] + 'time' 1964 1965 newvar = onewnc.createVariable(vname,'f8', (timedn)) 1966 basicvardef(newvar, vname, 'time simulations closest to observed values',\ 1967 obstunits ) 1968 set_attribue(newvar, 'calendar', 'standard') 1969 newvar[:] = closesttvalues[:,2] 1970 1971 vname = (prestdescsim[kst] + 'obstime' 1972 newvar = onewnc.createVariable(vname,'f8', (vname)) 1973 basicvardef(newvar, vname, 'closest time observations', obstunits) 1974 set_attribute(newvar, 'calendar', 'standard') 1975 newvar[:] = closesttvalues[:,3] 1976 1977 elif == stdescsim[kst] == 'B': 1965 dimt = Nclosest 1966 1967 1968 if ivar == 0: 1969 vname = prestdescsim[kst] + 'time' 1970 newvar = onewnc.createVariable(vname,'f8', (timedn)) 1971 basicvardef(newvar, vname, 'time simulations closest to observed ' + \ 1972 'values', obstunits ) 1973 set_attribute(newvar, 'calendar', 'standard') 1974 newvar[:] = closesttvalues[:,2] 1975 1976 vname = prestdescsim[kst] + 'obstime' 1977 newvar = onewnc.createVariable(vname,'f8', (vname)) 1978 basicvardef(newvar, vname, 'closest time observations', obstunits) 1979 set_attribute(newvar, 'calendar', 'standard') 1980 newvar[:] = closesttvalues[:,3] 1981 1982 elif stdescsim[kst] == 'B': 1978 1983 # Observed values temporally around coincident times 1979 1984 simobsvalues, simobsSvalues, simobsTtvalues, trjsim = \ 1980 1985 getting_ValidationValues(obskind, Ncoindt, dims, trajpos, ovsim, ovobs,\ 1981 1986 coindtvalues, oFillValue, Ngrid, 'tbackwardSmean') 1982 1983 vname = prestdescsim[kst] + 'time' 1984 newvar = onewnc.createVariable(vname,'f8', (timedn)) 1985 basicvardef(newvar, vname, 'simulation time between observations', \ 1986 obstunits ) 1987 set_attribute(newvar, 'calendar', 'standard') 1988 set_attribute(newvar, 'bounds', 'time_bnds') 1989 newvar[:] = simobsTtvalues[:,1] 1990 1991 vname = prestdescsim[kst] + 'obstime' 1992 newvar = onewnc.createVariable(vname,'f8', (vname)) 1993 basicvardef(newvar, vname, 'observed between time', obstunits ) 1994 set_attribute(newvar, 'calendar', 'standard') 1995 newvar[:] = np.unique(coindtvalues[:,2]) 1987 dimt = Ncoindt 1988 1989 if ivar == 0: 1990 vname = prestdescsim[kst] + 'time' 1991 newvar = onewnc.createVariable(vname,'f8', (timedn)) 1992 basicvardef(newvar, vname, 'simulation time between observations', \ 1993 obstunits ) 1994 set_attribute(newvar, 'calendar', 'standard') 1995 set_attribute(newvar, 'bounds', 'time_bnds') 1996 newvar[:] = simobsTtvalues[:,1] 1997 1998 vname = prestdescsim[kst] + 'obstime' 1999 newvar = onewnc.createVariable(vname,'f8', (vname)) 2000 basicvardef(newvar, vname, 'observed between time', obstunits ) 2001 set_attribute(newvar, 'calendar', 'standard') 2002 newvar[:] = np.unique(coindtvalues[:,2]) 1996 2003 1997 2004 # Re-arranging values... … … 2041 2048 # Statistics sim-obs 2042 2049 simobsstats = np.zeros((Nstsim,13), dtype=np.float) 2043 diffvals = np.zeros(( Ncoindt), dtype=np.float)2050 diffvals = np.zeros((dimt), dtype=np.float) 2044 2051 2045 2052 diffvals = arrayvals[:,0] - obsmask … … 2091 2098 simobsstats[kst,11] = 1. - sumdiff2/(abssimobsbias2series.sum()) 2092 2099 # Fractional Mean Bias (FMB) 2093 simobsstats[ks y,12]=(simstats[ksy,0]-obsstats[kst,0])/(0.5*(simstats[kst,0] +\2100 simobsstats[kst,12]=(simstats[kst,0]-obsstats[kst,0])/(0.5*(simstats[kst,0] +\ 2094 2101 obsstats[kst,0])) 2095 2102 2096 2103 # Statistics around sim values 2097 aroundstats = np.zeros((5, Ncoindt), dtype=np.float)2098 for it in range( Ncoindt):2104 aroundstats = np.zeros((5,dimt), dtype=np.float) 2105 for it in range(dimt): 2099 2106 aroundstats[0,it] = np.min(simobsSvalues[it,]) 2100 2107 aroundstats[1,it] = np.max(simobsSvalues[it,]) … … 2156 2163 if stdescsim[kst] == 'B': 2157 2164 if not searchInlist(onewnc.variables, 'time_bnds'): 2158 newvar = onewnc.createVariable('time_bnds','f8',( imedn,'bnds'))2165 newvar = onewnc.createVariable('time_bnds','f8',(timedn,'bnds')) 2159 2166 basicvardef(newvar, 'time_bnds', timedn, obstunits ) 2160 2167 set_attribute(newvar, 'calendar', 'standard') 2161 2168 newvar[:] = simobsTtvalues 2162 2163 # around obs Statistics between2164 if not searchInlist(onewnc.variables, prestdescsim[kst] + valvars[ivar][1] + \2165 'staround'):2166 vname = prestdescsim[kst] + valvars[ivar][1] + 'staround'2167 else:2168 vname = prestdescsim[kst] + valvars[ivar][1] + 'Staround'2169 2170 newvar = onewnc.createVariable(vname, 'f', (timedn,'tstats'), \2171 fill_value=fillValueF)2172 descvar = prestdescsim[kst] + ' around temporal observed statisitcs: ' + \2173 valvars[ivar][1]2174 basicvardef(newvar, vname, descvar, ovobs.getncattr('units'))2175 set_attribute(newvar, 'cell_methods', 'time_bnds')2176 newvar[:] = aroundostats.transpose()2177 2169 2178 2170 # sim Statistics
Note: See TracChangeset
for help on using the changeset viewer.