Global Hydrology Resource Center (GHRC) Infrared Images

How do I...?
Post Reply
User avatar
jconrado
Posts: 10
Joined: Thu Jan 28, 2016 5:16 pm

Global Hydrology Resource Center (GHRC) Infrared Images

Post by jconrado »

Hi,

I have some data from the Global Hydrology Resource Center (GHRC). Thes data are in the MCidas format. I use the MCIDAS-V to open and visualize then. On my image I have the map over the Infrared data. I would like to know how the MCIDAS-V navigate these data and how can I get a copy of the each values in the :

Area Directory Block
Auxiliary (AUX) Block
Navigation (NAV) Block


Thanks,

Conrado
Last edited by jconrado on Thu Feb 02, 2017 4:36 pm, edited 2 times in total.
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: Save the latitude and longitude array for one image

Post by bobc »

Hello Conrado -

To echo some of what Tom W mentioned to you on the IDV User's list email, there are a couple JPythonMethod methods you can use to get lat/lon arrays of your data.

First, you will want to load in your data to the Field Selector. Next, open the Jython Shell (Tools>Formulas>Jython Shell form the Main Display window), and run the following:

Code: Select all

a = selectData()

This pops up a Field Selector window where you will select the data you want to work with. This is the data that you just loaded in before going to the Jython Shell.

Code: Select all

d = getDomainSet(a[0])

This returns the sampling set for the domain of the object passed through the method, in this case, 'a'. The [0] is because your data probably has "time" as the first dimension. If this is not the case, then you can omit it from the command.

Code: Select all

lat,lon = getLatLons(d)

This returns latitude and longitude arrays of the data.

There is another forum user who was trying to do something similar to this a while back that is in a post here. There's another case where a user was doing something similar with getDomainSet here.

An alternative to this approach is to create a Grid Table display of your data. This creates a chart in the Layer Controls with columns for latitude, longitude, and data value. While there are no menu items to export this data, you can copy/paste all of the cells over to another program, such as Excel.

Hopefully this points you in the right direction.

Thanks -
Bob Carp
McIDAS Help Desk
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: Save the latitude and longitude array for one image

Post by bobc »

Hello Conrado -

You had sent me an email a while ago asking for more clarification on this. Here's a script that will write out all of the lat, lon, value points to a CSV file. This can be run through the Jython Shell (Tools>Formulas>Jython Shell) from the Main Display window. I've tested this with a grid as well as an AREA file loaded in through a local ADDE server. For more documentation on these things, see:

Jython Shell
Creating a local ADDE dataset. This can then be accessed through the Satellite>Imagery chooser with the <LOCAL-DATA> server.

Code: Select all

# Define the data.  In this Field Selector
# window, choose your data and domain.  This is
# dependent on the data already being loaded in.
data = selectData()

# JPython Methods to extract info from data
domain = getDomainSet(data[0])
lat, lon = getLatLons(domain)
val = getValues(data[0])

# At this point, we are working with arrays,
# verify this by running:
print 'lat: %s' %type(lat)
print 'lon: %s' %type(lon)
print 'val: %s' %type(val)

# Data currently in arrays, change to lists
# I believe vals is a multidimensional array
# which is why tolist() must be run twice.
lats = lat.tolist()
lons = lon.tolist()
vals = val.tolist()[0]
vals2 = vals.tolist()

# Now, lats, lons, and vals2 are all lists.
# You can verify this by running:
print 'lats: %s' %type(lats)
print 'lons: %s' %type(lons)
print 'vals2: %s' %type(vals2)

# Output to an already existing CSV file.  Change
# csv_out to point at your file
import csv
csv_out = open('C:/Users/rcarp/test.csv', 'wb')
mywriter = csv.writer(csv_out)
rows = zip(lats, lons, vals2)
mywriter.writerows(rows)
csv_out.close()
print 'File written'

Note that I've only tried working with a single image. I'm sure this could be done with multiple timesteps, and this would just involve putting some of this code in a loop.

- Bob Carp
User avatar
jconrado
Posts: 10
Joined: Thu Jan 28, 2016 5:16 pm

Re: Save the latitude and longitude array for one image

Post by jconrado »

bobc wrote:Hello Conrado -

You had sent me an email a while ago asking for more clarification on this. Here's a script that will write out all of the lat, lon, value points to a CSV file. This can be run through the Jython Shell (Tools>Formulas>Jython Shell) from the Main Display window. I've tested this with a grid as well as an AREA file loaded in through a local ADDE server. For more documentation on these things, see:

Jython Shell
Creating a local ADDE dataset. This can then be accessed through the Satellite>Imagery chooser with the <LOCAL-DATA> server.

Code: Select all

# Define the data.  In this Field Selector
# window, choose your data and domain.  This is
# dependent on the data already being loaded in.
data = selectData()

# JPython Methods to extract info from data
domain = getDomainSet(data[0])
lat, lon = getLatLons(domain)
val = getValues(data[0])

# At this point, we are working with arrays,
# verify this by running:
print 'lat: %s' %type(lat)
print 'lon: %s' %type(lon)
print 'val: %s' %type(val)

# Data currently in arrays, change to lists
# I believe vals is a multidimensional array
# which is why tolist() must be run twice.
lats = lat.tolist()
lons = lon.tolist()
vals = val.tolist()[0]
vals2 = vals.tolist()

# Now, lats, lons, and vals2 are all lists.
# You can verify this by running:
print 'lats: %s' %type(lats)
print 'lons: %s' %type(lons)
print 'vals2: %s' %type(vals2)

# Output to an already existing CSV file.  Change
# csv_out to point at your file
import csv
csv_out = open('C:/Users/rcarp/test.csv', 'wb')
mywriter = csv.writer(csv_out)
rows = zip(lats, lons, vals2)
mywriter.writerows(rows)
csv_out.close()
print 'File written'

Note that I've only tried working with a single image. I'm sure this could be done with multiple timesteps, and this would just involve putting some of this code in a loop.

- Bob Carp
Post Reply