Skip to content

Instantly share code, notes, and snippets.

View samiriff's full-sized avatar
🎯
Focusing

Samir Sheriff samiriff

🎯
Focusing
View GitHub Profile
query_processor = QueryProcessor()
query_results = query_processor.query_files_urls(target, mission, instrument, product_type,
western_lon, eastern_lon, min_lat, max_lat,
min_ob_time, max_ob_time, product_id, file_name,
number_product_limit, result_offset_number)
print("Total Number of Files of all bin types =", len(query_results.keys()))
query_result_processor = QueryResultProcessor()
should_continue = query_result_processor.download(query_results, bin_type)
if should_continue:
query_result_processor.process(SAVE_DIR_PREFIX, CHUNK_SIZE, SKIP_BLACK_IMAGES, ALIGN_AND_CROP_THRESHOLDS)
# Chunk Settings
SAVE_DIR_PREFIX = './chunks'
CHUNK_SIZE = 1024
SKIP_BLACK_IMAGES = True # Set to False to retain all images that contain black pixels
# Default Settings to Align and Crop images with black margins
MAX_BORDER_SIZE = 200 # Border to be checked around the image
SAFETY_MARGIN = 0 # Removes extra pixels from the sides to make sure no black remains
TOLERANCE = 10 # A gray value is more likely to be considered black when you increase the tolerance
ALIGN_AND_CROP_THRESHOLDS = (MAX_BORDER_SIZE, SAFETY_MARGIN, TOLERANCE) # Set to None to prevent alignment and cropping
target = 'mars' # Aimed planetary body, i.e., Mars, Mercury, Moon, Phobos, or Venus
mission = 'MRO' # Aimed mission, e.g., MGS or MRO
instrument = 'HIRISE' # Aimed instrument from the mission, e.g., HIRISE or CRISM
product_type = 'RDRV11' # Type of product to look for, e.g., DTM or RDRV11
western_lon = 234.24 # Western longitude to look for the data, from 0 to 360
eastern_lon = 234.25 # Eastern longitude to look for the data, from 0 to 360
min_lat = 68.21 # Minimal latitude to look for the data, from -90 to 90
max_lat = 68.22 # Maximal latitude to look for the data, from -90 to 90
product_id = '*RED*' # PDS Product Id to look for, with wildcards (*) allowed
min_ob_time = '' # Minimal observation time in (even partial) UTC format, e.g., '2017-03-01'
from ode_data_access.query_processor import QueryProcessor
from ode_data_access.query_result_processor import QueryResultProcessor
#!/usr/bin/env bash
###############################################################################
#
# demo-magic.sh
#
# Copyright (c) 2015 Paxton Hare
#
# This script lets you script demos in bash. It runs through your demo script when you press
# ENTER. It simulates typing and runs commands.
Rule Example Match Regex Rule
{First Name} Loki ([\w]+):
{First Name} {Last Name} Tony Stark ([\w]+[\s]+[\w]+):
{First Name} {Middle Name} {Last Name} Peter Benjamin Parker ([\w]+[\s]+[\w]+[\s]+[\w]+):
{Mobile Number (India)} +91 12345 67890 ([+]\d{2} \d{5} \d{5}):
{Mobile Number (US)} +12 345 678 901 ([+]\d{2} \d{3} \d{3} \d{4}):
{Mobile Number (Europe)} +12 3456 78901 ([+]\d{2} \d{4} \d{7})
messages_df['Hour'].value_counts().head(10).sort_index(ascending=False).plot.barh() # Top 10 Hours of the day during which the most number of messages were sent
plt.xlabel('Number of messages')
plt.ylabel('Hour of Day')
messages_df['Hour'] = messages_df['Time'].apply(lambda x : x.split(':')[0]) # The first token of a value in the Time Column contains the hour (Eg., "20" in "20:15")
messages_df['Time'].value_counts().head(10).plot.barh() # Top 10 Times of the day at which the most number of messages were sent
plt.xlabel('Number of messages')
plt.ylabel('Time')
messages_df['Date'].value_counts().head(10).plot.barh() # Top 10 Dates on which the most number of messages were sent
plt.xlabel('Number of Messages')
plt.ylabel('Date')