Subject: Marine Geospatial Ecology Tools (MGET) help
Text archives
From: | Murray Ford <> |
---|---|
To: | Jason Roberts <> |
Cc: | |
Subject: | Re: [mget-help] help with Netcdf file converstion |
Date: | Fri, 21 Oct 2011 07:10:05 +1200 |
Hi Murray,
Thanks for your interest in MGET. The error you mention sounds like a bug. What versions of ArcGIS and MGET are you running? And did you happen to install the Python numpy package yourself, and if so, what version? (If you did not install it yourself, MGET is relying either on one that ArcGIS installed or on one included in MGET, depending on what version of ArcGIS you have.)
Setting that aside for a moment, I can advise you on what parameters to use if you want to convert AVISO 1/3 degree netCDFs manually. There are a number of complicating factors to determining the parameters:
· The data are in a Mercator projection. While it is true that they have a resolution of 1/3 degree at the equator, they are not in a geographic projection with a cell size of 1/3 degree.
· The netCDF header does not provide any metadata you can use to determine the lower left corner coordinates. If you use Python to dump them out (via the netcdf4-python package, for example, which MGET uses) then you get geographic values. But because the data are in a projected system, you need to manually project those geographic values to the projected system to have the proper values.
· It is not clear whether the values are for the cell centers or the corners. After some analysis, I concluded they were for the cell centers, so the values
· AVISO does not specify the datum they use. (I have been through a three month email exchange with them about this and about the corner coordinates without getting to a final answer.) I eventually decided to use the one in ArcGIS called Mercator (Sphere) and based all of my calculations on that. Note that because Aviso data are centered on the 180th parallel, not the Prime Meridian, the default ArcGIS spatial reference needs to be modified.
· The Grid_0001:_FillValue attribute should be used as the NoData value in the MGET tool, but for complex reasons the value listed in the netCDF header (1.844674e+019) does not provide sufficient precision. Instead you have to use the _FillValue you see for the other netCDF variables above in the file (1.84467440737096e+019).
· The image dimensions are not ordered in the way that is traditional for ArcGIS, so the image must be manipulated to the proper orientation.
Anyway, here are the parameter values I suggest:
Variable name: Grid_0001
X coordinate of lower-left corner: -19996554.3082465
Y coordinate of lower-left corner: -16930277.8509041
Cell size: 37064.9755481862
NODATA value: 1.84467440737096E+19
Pre-conversion processing:
Transpose: checked
Flip: checked
Post-conversion processing:
Define coordinate system: select Mercator (Sphere) but modify Central_Meridian to 180.
I’m not 100% sure these parameters are correct, but since the data are only 1/3 degree resolution, tweaking them slightly one way or the other should not make a big difference.
Here is some Python code that I used to derive the parameters:
# To compute CornerCoords of Aviso global Mercator grid:
#
# >>> from GeoEco.Datasets import Dataset
# >>> sr1 = Dataset.ConvertSpatialReference('proj4', '+proj=latlong +ellps=WGS84 +datum=WGS84 +no_defs', 'obj')
# >>> sr2 = Dataset.ConvertSpatialReference('proj4', '+proj=merc +R=6371000 +lon_0=180.0 +no_defs', 'obj')
# >>> transformer = Dataset._osr().CoordinateTransformation(sr1, sr2)
# >>> xLLC, yLLC = transformer.TransformPoint(0.0, -82.0)[:2] # These are from the LatLonMin OPeNDAP variable
# >>> cellSize = 6371000. * 2 * math.pi / 360 / 3 # 1/3 degree cell size at equator (1080 columns)
# >>> cellSize
# 37064.975548186245
# >>> xLLC += cellSize/2; yLLC += cellSize/2 # Get center coords of lower-left corner cell
# >>> xLLC, yLLC
# (-19996554.308246486, -16930277.850904137)
Best,
Jason
From: Murray Ford [mailto:]
Sent: Wednesday, October 19, 2011 5:52 PM
To:
Subject: [mget-help] help with Netcdf file converstion
G'Day
I am new to the MGET tools and from what I've seen so far I am very impressed. I am trying to work with some AVIOS data (sea level anomaly). The tool which allows direct import into ArcGIS is great. But for my own curiosity I am trying to have play with the Netcdf to ArcGIS raster tool.
When I run the tool I get the error "not yet implemented for numpy.ma arrays"
I think I am coming unstuck on defining the lower left corner of the raster, or perhaps the cell size. I have attached the header for the file I am working with.
For this file should I have
Resolution = 1/3 deg. or I assume I use .333?
What about the lower left?
Anything you can offer up would be warmly received.
Murray
--Murray Ford, Ph.D.
Coastal Processes/Management Extension Agent
University of Hawaii Sea Grant College Program
P.O. Box 1258
Majuro, MH 96960
Marshall Islands
--