Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UAVSAR cropping fixes for stackStripmapApp #367

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions contrib/stack/stripmapStack/cropFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,18 @@ def cropFrame(frame, limits, outdir, israw=False):
####sensing start
ymin = np.floor( (limits[0] - frame.sensingStart).total_seconds() * frame.PRF)
print('Line start: ', ymin)
ymin = np.int( np.clip(ymin, 0, frame.numberOfLines-1))
ymin = int( np.clip(ymin, 0, frame.numberOfLines-1))


####sensing stop
ymax = np.ceil( (limits[1] - frame.sensingStart).total_seconds() * frame.PRF) + 1
print('Line stop: ', ymax)
ymax = np.int( np.clip(ymax, 1, frame.numberOfLines))
ymax = int( np.clip(ymax, 1, frame.numberOfLines))

print('Line limits: ', ymin, ymax)
print('Original Line Limits: ', 0, frame.numberOfLines)

if (ymax-ymin) <= 1:
if (ymax-ymin) < 0:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you want to allow zero? Does zero mean that there is one pixel overlap?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @ssangha, I think this is the only part we'd like clarification about. LGTM otherwise.

raise Exception('Azimuth limits appear to not overlap with the scene')


Expand All @@ -185,18 +185,18 @@ def cropFrame(frame, limits, outdir, israw=False):
####starting range
xmin = np.floor( (limits[2] - frame.startingRange)/frame.instrument.rangePixelSize)
print('Pixel start: ', xmin)
xmin = np.int(np.clip(xmin, 0, (frame.image.width//factor)-1))
xmin = int(np.clip(xmin, 0, (frame.image.filename//factor)-1))

####far range
xmax = np.ceil( (limits[3] - frame.startingRange)/frame.instrument.rangePixelSize)+1
print('Pixel stop: ', xmax)

xmax = np.int(np.clip(xmax, 1, frame.image.width//factor))
xmax = int(np.clip(xmax, 1, frame.image.filename//factor))

print('Pixel limits: ', xmin, xmax)
print('Original Pixel Limits: ', 0, frame.image.width//factor)
print('Original Pixel Limits: ', 0, frame.image.filename//factor)

if (xmax - xmin) <= 1:
if (xmax - xmin) < 0:
raise Exception('Range limits appear to not overlap with the scene')

outframe.startingRange = frame.startingRange + xmin * frame.instrument.rangePixelSize
Expand Down
6 changes: 6 additions & 0 deletions contrib/stack/stripmapStack/prepareUAVSAR_coregStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ def write_xml(shelveFile, slcFile):
slc.renderHdr()
slc.renderVRT()

# set filename in shelvefile
frame.image.filename = os.path.join(os.path.dirname(shelveFile), slcFile)
frame.image.width = width
with shelve.open(shelveFile) as db:
db['frame'] = frame


def get_Date(file):
yyyymmdd='20'+file.split('_')[4]
Expand Down