Skip to content

Commit

Permalink
Updated kaguya cropping notebook to handle bands
Browse files Browse the repository at this point in the history
  • Loading branch information
acpaquette committed Dec 9, 2020
1 parent da6126e commit d502889
Showing 1 changed file with 45 additions and 145 deletions.
190 changes: 45 additions & 145 deletions isis/notebooks/crop_kaguya.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -17,19 +17,17 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#kaguya_file = '/scratch/arsanders/kaguyatc/TC2S2B0_01_03043N107E3384.img'\n",
"#kaguya_file = '/home/arsanders/testData/apollo/AS15-M-1450.lbl'\n",
"kaguya_file = '/home/arsanders/testData/marci/MOI_000009_0294_MU_00N044W.IMG'\n",
"kaguya_file = '/Path/to/kaguyami/or/kaguyatc.img'\n",
"image_file = kaguya_file"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -38,104 +36,35 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"PVLModule([\n",
" ('PDS_VERSION_ID', 'PDS3')\n",
" ('FILE_NAME', 'MOI_000009_0294_MU_00N044W.IMG')\n",
" ('RECORD_TYPE', 'FIXED_LENGTH')\n",
" ('RECORD_BYTES', 128)\n",
" ('FILE_RECORDS', 2259)\n",
" ('LABEL_RECORDS', 11)\n",
" ('^IMAGE', 12)\n",
" ('SPACECRAFT_NAME', 'MARS_RECONNAISSANCE_ORBITER')\n",
" ('INSTRUMENT_NAME', 'MARS COLOR IMAGER')\n",
" ('INSTRUMENT_HOST_NAME', 'MARS RECONNAISSANCE ORBITER')\n",
" ('MISSION_PHASE_NAME', 'POSTMOI')\n",
" ('TARGET_NAME', 'MARS')\n",
" ('INSTRUMENT_ID', 'MARCI')\n",
" ('PRODUCER_ID', 'MRO_MARCI_TEAM')\n",
" ('DATA_SET_ID', 'MRO-M-MARCI-2-EDR-L0-V1.0')\n",
" ('PRODUCT_CREATION_TIME',\n",
" datetime.datetime(2007, 5, 17, 18, 31, 28, tzinfo=datetime.timezone.utc))\n",
" ('SOFTWARE_NAME', 'makepds05 $Revision: 1.7 $')\n",
" ('UPLOAD_ID', 'UNK')\n",
" ('ORIGINAL_PRODUCT_ID', '4A_05_0001000200')\n",
" ('PRODUCT_ID', 'MOI_000009_0294_MU_00N044W')\n",
" ('START_TIME',\n",
" datetime.datetime(2006, 3, 24, 4, 25, 53, 96000, tzinfo=datetime.timezone.utc))\n",
" ('STOP_TIME',\n",
" datetime.datetime(2006, 3, 24, 4, 55, 48, 296000, tzinfo=datetime.timezone.utc))\n",
" ('SPACECRAFT_CLOCK_START_COUNT', '827641567:30')\n",
" ('SPACECRAFT_CLOCK_STOP_COUNT', 'N/A')\n",
" ('INTERFRAME_DELAY', Quantity(value=3.2, units='SECONDS'))\n",
" ('FOCAL_PLANE_TEMPERATURE', Quantity(value=240.9, units='K'))\n",
" ('SAMPLE_BIT_MODE_ID', 'SQROOT')\n",
" ('LINE_EXPOSURE_DURATION', Quantity(value=3112.237, units='MSEC'))\n",
" ('SAMPLING_FACTOR', 8)\n",
" ('SAMPLE_FIRST_PIXEL', 0)\n",
" ('FILTER_NAME', frozenset({'LONG_UV', 'SHORT_UV'}))\n",
" ('RATIONALE_DESC', 'Post-MOI image of Argyre and Mare Erythraeum region')\n",
" ('DATA_QUALITY_DESC', 'OK')\n",
" ('ORBIT_NUMBER', 9)\n",
" ('IMAGE',\n",
" {'CHECKSUM': 12820826,\n",
" 'LINES': 2248,\n",
" 'LINE_PREFIX_BYTES': 0,\n",
" 'LINE_SAMPLES': 128,\n",
" 'LINE_SUFFIX_BYTES': 0,\n",
" 'SAMPLE_BITS': 8,\n",
" 'SAMPLE_BIT_MASK': 255,\n",
" 'SAMPLE_TYPE': 'UNSIGNED_INTEGER'})\n",
"])"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"header"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"12"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"header[\"^IMAGE\"]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"with open(kaguya_file, 'rb') as f:\n",
" try:\n",
" # For marci image \n",
" image_offset = header['^IMAGE'] * header['LABEL_RECORDS'] * header[\"RECORD_BYTES\"] - (header['IMAGE']['SAMPLE_BITS']//8)\n",
" # image_offset = header['^IMAGE'] * header['LABEL_RECORDS'] * header[\"RECORD_BYTES\"] - (header['IMAGE']['SAMPLE_BITS']//8)\n",
" \n",
" # For others\n",
" # image_offset = header[\"^IMAGE\"].value-(header['IMAGE']['SAMPLE_BITS']//8) \n",
" image_offset = header[\"^IMAGE\"].value-(header['IMAGE']['SAMPLE_BITS']//8) \n",
" \n",
" f.seek(image_offset)\n",
" b_image_data = f.read()\n",
Expand All @@ -149,82 +78,53 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"n_lines = 40\n",
"n_lines = 20\n",
"n_bands = 2\n",
"if \"BANDS\" not in header[\"IMAGE\"].keys():\n",
" n_bands = 1\n",
"line_length = header['IMAGE']['LINE_SAMPLES'] * (header['IMAGE']['SAMPLE_BITS']//8)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"image_data = []\n",
"for j in range(n_lines):\n",
" image_sample = np.frombuffer(b_image_data[j*line_length:(j+1)*line_length], dtype=np.int16, count=int(line_length/2))\n",
" image_data.append(image_sample)\n",
"for i in range(n_bands):\n",
" image_data.append([])\n",
" for j in range(n_lines):\n",
" image_sample = np.frombuffer(b_image_data[j*line_length:(j+1)*line_length], dtype=np.int16, count=int(line_length/2))\n",
" image_data[i].append(image_sample)\n",
"image_data = np.array(image_data)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(40, 64)"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"image_data.shape"
"image_data.min()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.image.AxesImage at 0x10ec70fd0>"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAADyCAYAAABUFp5YAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAc50lEQVR4nO3de3Bc5XkG8OfZXdkyssF2MNQFTwmUps0wiUkVhwSSEHOzHQghk2Qg0wxtmTF/hA60ZBonnbZJ+0chJaTpkNI6xY2bpqSES2FcczEOlDBDwDIYY2MbA3GCwVjcjG1d9/L2Dx0XWd972LPaPSt98vOb0Uj6dM7ud1bSq9W+53wPzQwiIhKfwkRPQERExkcFXEQkUirgIiKRUgEXEYmUCriISKRUwEVEItVUASe5hOQOks+TXNGqSYmISH0c73ngJIsAngNwHoDdADYAuMzMnm3d9EREJE2piX0XAXjezF4EAJI/AXAxgNQCXuzqstLcuU3cpbTK7Fl9mbetgeGYhf+81VKfC4T7e5vWLNyuEebcTwM7NzKc7b4buE3LeOxp27nPw7xta852teYed8nf8O7dr5vZvLHjzRTwEwC8NOrz3QA+8m47lObOxQnX/GkTdymtcuHiDe540fkNP1idHoz1VcKx4VrRvU2vMFecbQcqHcEY6VfBqvMHpFIb/yuCaYXRu01vRlVnu7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ewsP6zSYSYLkTAB3ALjGzPZP9HyaYWZVM1uIkWeui0ieNsFTGjeSFwLoNbONEz2XFjvTzD6EkZdUv0LyExM9oSaUAHwIwM1mdjqAPrTh5Z92F/DdABaM+vxEAK+0eQ552UtyPgAk73sneD4NIdmBkeL9YzO7MxmO+pgAwMz2AXgYIz2LWI/nTACfIbkLwE8ALCb5H4j3eAAAZvZK8r4XwF0AFiHeY9oNYHfynx4A3I6Rgp7r8bS7gG8AcCrJ95KcBuBSAPe0eQ55uQfA5cnHl2PkdeQokCSAWwBsM7MbR30pymMiOY/k7OTjGQDOBbAdkR6PmX3dzE40s5Mw8jvzMzP7A0R6PABAsovkrEMfAzgfwBZEekxm9iqAl0i+Lxk6B8CzyPt4JuDF/mUAngPwAoC/mOjmwziP4VYAewCUMfKX9woA78FIk2ln8n7uRM+zgeM5CyMvZW0GsCl5WxbrMQH4AICnkuPZAuCvkvEoj2fMsZ2Nd5qY0R4PRl4zfjp523qoFkR+TAsB9CQ/d/8NYE7ex6MrMUVEIqUrMUVEIqUCLiISKRVwEZFIqYCLiERKBVxEJFIq4CIikVIBFxGJlAq4iEik/g8d2w/PZ/MEAgAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"plt.imshow(image_data)"
"plt.imshow(image_data[0])"
]
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -241,7 +141,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -256,6 +156,7 @@
"\n",
"# Overwrite the number of lines in the label\n",
"header['IMAGE']['LINES'] = n_lines\n",
"header['IMAGE']['BANDS'] = n_bands\n",
"\n",
"if kaguya_file != image_file:\n",
" # If detached label, point the mini label to the mini image\n",
Expand All @@ -268,30 +169,20 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1820"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"label_fn, label_ext = os.path.splitext(kaguya_file)\n",
"out_label = label_fn + crop + label_ext\n",
"print(out_label)\n",
"\n",
"pvl.dump(header, out_label, encoder=encoder, grammar=grammar)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -301,6 +192,15 @@
" f.write(b_reduced_image_data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"pvl.load(mini_image_fn)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -325,7 +225,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.0"
"version": "3.7.1"
}
},
"nbformat": 4,
Expand Down

0 comments on commit d502889

Please sign in to comment.