예제 #1
0
use_db = "mysql-Q"  # 'sqlite'  Use local sqlite file-based db
# 'mysql-Q' Use the remote MySQL database on Q
user = "******"  # only needed for remote databases.
password = ""  # See example109 for setting-up an encrypted password.  In this case leave password="", and
# init_db_conn_old() will automatically find and use your saved password. Otherwise, enter your MySQL password here.

# ------------ NO NEED TO UPDATE ANYTHING BELOW  ------------- #
start_time_tot = time.time()

# connect to database
if use_db == 'sqlite':
    # setup database connection to local sqlite file
    sqlite_path = os.path.join(database_dir, sqlite_filename)

    db_session = init_db_conn_old(db_name=use_db,
                                  chd_base=db_class.Base,
                                  sqlite_path=sqlite_path)
elif use_db == 'mysql-Q':
    # setup database connection to MySQL database on Q
    db_session = init_db_conn_old(db_name=use_db,
                                  chd_base=db_class.Base,
                                  user=user,
                                  password=password)

# create mu bin array
mu_bin_array = np.array(range(n_mu_bins + 1), dtype="float") * 0.05 + 0.1
mu_bin_centers = (mu_bin_array[1:] + mu_bin_array[:-1]) / 2

# time arrays
# returns array of moving averages center dates, based off start and end date
moving_avg_centers, moving_width = lbcc.moving_averages(query_time_min,
예제 #2
0
# set movie frames-per-second
fps = 12  # one day per second
# set frame dots per inch
dpi = 300  # set to None for automatic dpi estimation

# designate which database to connect to
use_db = "mysql-Q"  # 'sqlite'  Use local sqlite file-based db
# 'mysql-Q' Use the remote MySQL database on Q
# 'mysql-Q_test' Use the development database on Q
user = "******"  # only needed for remote databases.
password = ""  # See example109 for setting-up an encrypted password.  In this case leave password="", and
# init_db_conn_old() will automatically find and use your saved password. Otherwise, enter your MySQL password here.

# Establish connection to database
db_session = db_funs.init_db_conn_old(db_name=use_db,
                                      chd_base=DBClass.Base,
                                      user=user,
                                      password=password)

# --- Begin execution ----------------------
# estimate dates for start/end of rotation
CR_start = datetime.datetime(1853, 11, 9)
CR_dur = datetime.timedelta(days=27.2753)
estimated_center_date = CR_start + (cr_rot - 0.5) * CR_dur
# get the decimal Carrington number for Earth at this time
cr_earth = sunpy.coordinates.sun.carrington_rotation_number(
    estimated_center_date)
# calc reasonable estimate of rotation start/end
movie_start = estimated_center_date - (cr_earth - cr_rot) * CR_dur
movie_end = estimated_center_date + (cr_rot + 1 - cr_earth) * CR_dur

# query maps in time range
예제 #3
0
n_intensity_bins = 200
R0 = 1.01
log10 = True
lat_band = [-np.pi / 2.4, np.pi / 2.4]

# define database paths
raw_data_dir = App.RAW_DATA_HOME
hdf_data_dir = App.PROCESSED_DATA_HOME
database_dir = App.DATABASE_HOME
sqlite_filename = App.DATABASE_FNAME

# setup database connection
use_db = "sqlite"
sqlite_path = os.path.join(database_dir, sqlite_filename)
db_session = init_db_conn_old(db_name=use_db,
                              chd_base=db_class.Base,
                              sqlite_path=sqlite_path)
# use_db = "mysql-Q"
# user = "******"
# password = ""
# sqlite_path = os.path.join(database_dir, sqlite_filename)
# db_session = db_funcs.init_db_conn_old(db_name=use_db, chd_base=db_class.Base, user=user, password=password)

#### ----- GENERATE HISTOGRAMS ---- ####
# start time
start_time = time.time()

#### GET REFERENCE INFO FOR LATER USE ####
#### GET REFERENCE INFO FOR LATER USE ####
# get index number of reference instrument
ref_index = inst_list.index(ref_inst)
예제 #4
0
HISTORY:
- This example was adapted by CD from commented code by TE in image_testing.py on 2021/01/04
"""
import pandas as pd
import datetime
from chmap.database.db_funs import init_db_conn_old, update_image_val, query_euv_images
from chmap.database.db_classes import Base, EUV_Images
from chmap.utilities.file_io.io_helpers import print_full_dataframe

# setup the mysql session
use_db = "mysql-Q"
user = "******"
password = ""
db_session = init_db_conn_old(db_name=use_db,
                              chd_base=Base,
                              user=user,
                              password=password)

# columns to print when running the script (so i can read it...)
columns = [
    'image_id', 'date_obs', 'instrument', 'wavelength', 'flag', 'fname_raw',
    'fname_hdf'
]

# OPTIONAL query a specific date to get image_ids of UNFLAGGED IMAGES (right now query_euv_images only looks for flag=0)
# set this to False if you want the script to continue
do_check_ids = False
if do_check_ids:
    period_start = datetime.datetime(2020, 2, 24, 1, 0, 0)
    period_end = datetime.datetime(2020, 2, 24, 3, 0, 0)
    query = query_euv_images(db_session=db_session,