reading a sector from a McIdas area file, How display??

I have a large mcidas area file (140,000,000)
I would like to read the header and then set up a sector to read just a
postage stamp
out of this large file.

AreaAdapter(request,y1,x1,ny,nx,iband)

provides a method to read just a piece of the file.

But how to figure out x1,y1,nx,ny???

I can get the coordinate system:
and convert lat/lon to something or other:
fromReference(ltln) but the output has NEGATIVE numbers:


ltln=((30.0, 40.0, 30.0, 40.0), (-110.0, -110.0, -90.0, -90.0))
print edges:
array([array([491.48200375087663, 595.5028231133533, 1286.9993700514306,
1286.99
94673741594], double), array([-487.346590672282, -285.71647212115636,
-480.43006
671186663, -278.1335195483199], double)], [D)

_From this what should x1,y1,nx,ny be??

How can I display this image in image coordinates, not remapped to a
lat/lon grid?



here is the full test code

from visad import RealType, RealTupleType, FunctionType, FieldImpl,
ScalarMap, Display
from visad.data.mcidas import AreaAdapter
from visad.util import AnimationWidget
from visad.python.JPythonMethods import *
from javax.swing import JFrame, JPanel
from visad.data.visad import VisADForm
from java.awt import BorderLayout, FlowLayout, Font
from java.awt import *
from java.awt.event import *
from java.lang import String
from visad import *
from visad import Real, Unit
from java.lang import Math
from graph import *
from subs import *

class getFile:
   def __init__ (self, fileName, iband):
      print fileName
      self.area=None
      self.fileName=fileName
      request="file:"+fileName
      print "requesf " + request
      adum=AreaAdapter(request,0,0,10,10)   # does this read all the
image or just the corner?
      et=adum.getNominalTime()
      print " time ",et
      getd=adum.getDimensions()
      print "channel2 ",getd[0]
      print "elem ",getd[1]
      print "line ",getd[2]
      nav=adum.getCoordinateSystem()
#         latlon = makeDomain(RealTupleType.LatitudeLongitudeTuple, 30.,
40., 2, -110.,-90., 2)
#      dumpTypes(latlon)
# this did not work
ltln=((30.,-110.),(40.,-110.),(30.,-90.),(40.,-90.))
      ltln=((30.,40.,30.,40.),(-110.,-110.,-90.,-90.))
#          what order does fromReference want
      print ltln
      edges=nav.fromReference(ltln)
#          what order does fromReference want
      print edges
#array([array([491.48200375087663, 595.5028231133533,
1286.9993700514306, 1286.99
#94673741594], double), array([-487.346590672282, -285.71647212115636,
-480.43006
#671186663, -278.1335195483199], double)], [D)
#               what numbers from edges should I use in the following???
      self.area=AreaAdapter(request,0,0,getd[2],getd[1],iband)

fileName="c:/TtoP/AREA8046"
getF=getFile(fileName,4)
dimg=getF.area.getData()
dumpTypes(dimg)
plot(dimg)   
# I wonder why this produces just a gray plot?
# How can I display just the image in image coordinates, not remapped to
lat/lon?


Thanks for suggestions


G. Garrett Campbell Ph. D.
Cooperative Institute for Research in the Atmosphere
Colorado State University
Ft. Collins, CO, USA
970 491 8497
campbell@xxxxxxxxxxxxxxxxxx 


  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: