Esempio n. 1
0
from SunSpot import autocorrelations as bbl

### load data (loaded automatically with package)
data_path = pkg.resource_filename(pkg.Requirement.parse("SunSpot"), 'data')

with open(data_path + '/data_1981', 'rb') as file:
    #with open('data/data_1981', 'rb') as file: #local
    my_depickler = pickle.Unpickler(file)
    Ns = my_depickler.load()  #number of spots
    Ng = my_depickler.load()  #number of sunspot groups
    Nc = my_depickler.load()  #composite: Ns+10Ng
    station_names = my_depickler.load()  #codenames of the stations
    time = my_depickler.load()  #time

### compute the long-term errors
mu2 = err.long_term_error(Ng, period_rescaling=14, wdw=27)

### discard stations with no values
ind_nan = []
for i in range(mu2.shape[1]):
    if not np.all(np.isnan(mu2[:, i])):
        ind_nan.append(i)
mu2 = mu2[:, ind_nan]
station_names = [
    station_names[i] for i in range(len(station_names)) if i in ind_nan
]
(n_obs, n_series) = mu2.shape

### apply preprocessing
dataNs = pre.PreProcessing(mu2)
dataNs.level_removal(wdw=4000)  #remove intrisic levels
Esempio n. 2
0
    station_names = my_depickler.load()  #codenames of the stations
    time = my_depickler.load()  #time

n_data = len(Nc[~np.isnan(Nc)])
n_perc = n_data * 100 / (Nc.shape[0] * Nc.shape[1])

### add new data to station KS (not included in database)
data_ks = np.loadtxt(data_path + '\kisl_wolf.txt',
                     usecols=(0, 1, 2, 3),
                     skiprows=1)
#data_ks = np.loadtxt('data/kisl_wolf.txt', usecols=(0,1,2,3), skiprows=1) #local
Nc_ks = data_ks[9670:23914, 3]
Nc[:, 24] = Nc_ks

### compute the long-term errors
mu2 = err.long_term_error(Nc, period_rescaling=10, wdw=365)

### discard stations with no values
ind_nan = []
for i in range(mu2.shape[1]):
    if not np.all(np.isnan(mu2[:, i])):
        ind_nan.append(i)
mu2 = mu2[:, ind_nan]
station_names = [
    station_names[i] for i in range(len(station_names)) if i in ind_nan
]
(n_obs, n_series) = mu2.shape

### apply preprocessing
dataNs = pre.PreProcessing(mu2)
dataNs.level_removal(wdw=4000)  #remove intrisic levels
Esempio n. 3
0
from SunSpot import autocorrelations as bbl

### load data (loaded automatically with package)
data_path = pkg.resource_filename(pkg.Requirement.parse("SunSpot"), 'data')

with open(data_path + '/data_1981', 'rb') as file:
    #with open('data/data_1981', 'rb') as file: #local
    my_depickler = pickle.Unpickler(file)
    Ns = my_depickler.load()  #number of spots
    Ng = my_depickler.load()  #number of sunspot groups
    Nc = my_depickler.load()  #composite: Ns+10Ng
    station_names = my_depickler.load()  #codenames of the stations
    time = my_depickler.load()  #time

### compute the long-term errors
mu2 = err.long_term_error(Ns, period_rescaling=8, wdw=365)

### discard stations with no values
ind_nan = []
for i in range(mu2.shape[1]):
    if not np.all(np.isnan(mu2[:, i])):
        ind_nan.append(i)
mu2 = mu2[:, ind_nan]
station_names = [
    station_names[i] for i in range(len(station_names)) if i in ind_nan
]
(n_obs, n_series) = mu2.shape

### apply preprocessing
dataNs = pre.PreProcessing(mu2)
dataNs.level_removal(wdw=4000)  #remove intrisic levels