Re: Latitude and longitude of globir area data
Posted: Wed May 11, 2022 6:40 pm
by bobc
Hello,
We have an
inquiry written up to able to export the output of a Grid Table display to CSV/Excel format. However, this functionality is not currently available. In the past, we've suggested that users click in one of the cells of the Grid Table display, do Ctrl+A to select all of the cells, then Ctrl+C to copy the table. This table can then be pasted into Excel or another application. You can give this a try, though some tables may be too large to do this copy/paste.
If you are working with gridded data, there is a
formula "Export > Export Grid to Excel" that you can try.
If you are using satellite imagery from an ADDE server, you can try using something like the following script to write a CSV file with rows for Latitude, Longitude, and Data Value. You will need to update the directory path to the CSV file. I was able to run this in the
Jython Shell and write out a CSV file with more rows/columns than I could copy/paste from the Grid Table display:
Code: Select all
# load in some satellite data
addeParms = dict(
server = 'adde.ucar.edu',
dataset = 'RTGOESR',
descriptor = 'CONUS',
band = 13,
unit = 'TEMP',
size = 'ALL',
)
data = loadADDEImage(**addeParms)
# get at the lat/lon values of the data
domainSet = getDomainSet(data)
dataLatLons = getLatLons(domainSet)
lats = dataLatLons[0]
lons = dataLatLons[1]
# get all of the data values
dataVals = getValues(data)
# initialize empty lists for lat, lon, values
lat = []
lon = []
val = []
# create individual lists for lat, lon, and data values
for x in range(0, len(lats)):
lat.append(lats[x])
lon.append(lons[x])
val.append(dataVals[0][x])
# write lat, lon, and data values to csv file
import csv
header = ['Latitude', 'Longitude', 'Value']
with open('C:/Users/rcarp/sat_data_conus.csv', 'wb') as csv_out:
mywriter = csv.writer(csv_out)
mywriter.writerow(header)
rows = zip(lat, lon, val)
mywriter.writerows(rows)
# print 'done' so the user knows the script is complete
print('done')
There are several resources available to learn more about scripting in McIDAS-V, including the
User's Guide and the Scripting tutorials on our
Documentation page. The Advanced Scripting tutorial covers a good bit of the script I posted above outside of writing the data lists to a CSV file.
Thanks,
Bob Carp
McIDAS User Services
Re: Latitude and longitude of globir area data
Posted: Thu May 12, 2022 2:17 pm
by jconforte
Mr. Bob Carp,
I did that you wrote Grid Table display, do Ctrl+A to select all of the cells, then Ctrl+C to copy the table. But, I didn't had success, the tables may be too large to do this copy/paste. Then I use the option:
formula "Export > Export Grid to Excel" and I save it the name globir.xlm, attached it is a copy of this file. How can you see, I don't have the latitude and longitude grid.
The data that I'm using I downloade from NASA's Earthdata, This data are in Area format, it is a mosaic of several geostarionary satellites.
I already use a python script to read this data. IN McIDAS-V - Data Explorer -> File -> Save I save the data displayed as Netcdf and I have these two mcidas_area in my file,
mcidas_area:AreaDirectory = 0., 4., 11., 122132., 0., 7162., 5051., 0., 5400., 9900., 1., 1., 1., 1., 0., 0., 122132., 1854., 8., 0., 0., 0., 0., 0., 538976288., 538976288., 538976288., 538976288., 538976288., 538976288., 538976288., 538976288., 9076., 768., 256., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 122132., 0., 0., 0., 0., 0., 1447646034., 1112688980., 0., 0., 0., 1447646034., 538976288., 1., 0., 0., 0., 0., 2. ;
mcidas_area:NavBlock = 1296388675., 10000., 10000., 0., 4000., 1100000., 6378137., 81819., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. ;
I would like know how the McIDAS V use the mcidas_area to navigate the image to get the latitude and longitude values for each pixel.
I'm not using using satellite imagery from an ADDE server, then I don't know how can I use the script tthat you send me
Thanks for your help,
Conrado