<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Kurt.<br>
Thanks for the reply.<br>
<br>
You are correct that mbgrid outputs a GMT netCDF file. I was
running gdal_translate to overcome a weirdness that may no longer
exist but previously caused the output to be reflected when
displayed in GIS tools. This was due to a difference between GDAL
utilities and the GMT tools in indexing the data (as I recall).<br>
<br>
Geotiffs are a nice alternative. I was just used to using netCDF.<br>
<br>
Joaquim Luis explained the problem as due to gdal using an old GMT3
format (below)<br>
<br>
>><br>
John,<br>
<br>
No wonder the headers are different. The gdal_translate -of GMT
converts the grid into the old-old-old GMT3 version netCDF that was
not CF compliant. And if you want to do that, no need to call
gdal_translate, all you need is to append '=cf' to grid's name of
mbgrid command (I'm assuming that mbgrid delegates all grid writing
work to GMT).<br>
<br>
In summary, I don't see any problem here as it's very unlikely that
Arc will be able to read that old-old-old netCDF variant (unless it
lets GDAL do all the work)<br>
<br>
Joaquim<br>
>><br>
<br>
<br>
J.<br>
<br>
<div class="moz-cite-prefix">On 5/5/13 5:39 PM, Kurt Schwehr wrote:<br>
</div>
<blockquote
cite="mid:0274C33B-89D5-4F37-9BA8-6F7DC0D7040A@yahoo.com"
type="cite">
<meta http-equiv="Context-Type" content="text/html;
charset=iso-8859-1">
<div>Hi John,</div>
<div><br>
</div>
<div>- It's Sunday so the brain isn't really engaged, but doesn't
mbgrid output a gmt grd file? (your dump shows that) Why are
you running gdal_translate when your issue was with qgis/gdal
and your destination is ArcGIS?</div>
<div><br>
</div>
- gdal 1.10.0 is just out. Before trying anything else, you might
try upgrading to that.
<div><br>
</div>
<div>- Why not write a geotif from gdal? You get the option of
LZW compression then and a lot more tools can read geotif than
can read gmt netcdf grids... it's also a much more tested path
through gdal. Since I never seem to remember how to do compress
and I always seem monstrous amounts of files... for the record,
to LZW compress a geotif, add this:</div>
<div> -co "COMPRESS=LZW"</div>
<div><br>
</div>
<div>- are you seeing the same things from gdalinfo on the output
as the input? (e.g. is gdal being self consistent)</div>
<div><br>
</div>
<div>- you never mentioned what options you were passing to
gdal_translate. One of your options could be the issue.</div>
<div><br>
</div>
<div>-kurt</div>
<div><br>
<div>
<div>On May 5, 2013, at 2:04 PM, John Helly <<a
moz-do-not-send="true" href="mailto:hellyj@ucsd.edu">hellyj@ucsd.edu</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div> Hi.<br>
<br>
A few years ago I had a problem with GMT/GDAL interactions
such that the GMT netCDF files were reflected when read
into Qgis (for example). This was worked around by running
it through 'gdal_translate -of GMT'. There was also a
discussion about this being a bug in something in GDAL
(since Qgis was using GDAL if I remember correctly) that
was supposed to have been fixed in some version (obviously
don't remember the details). At any rate, it stopped being
a problem for me but now something else is causing a
problem in files that have the following workflow:<br>
<br>
--> mbgrid (from MB-System) --> gdal_translate -of
GMT --> ArcGIS netCDF reader<br>
<br>
Now I find that gdal_translate appears to be changing the
header in a way such that ArcGIS cannot read the netCDF.
The first 'ncdump -h' below is what the header looks like
before running through gdal_translate and the second one
is after gdal_translate.<br>
<br>
I'm sending this note to MB-System, GMT and GDAL groups
since it seems like an issue of import to all three. Any
thoughts on this?<br>
<br>
J.<br>
<br>
=======================================Output from mbgrid
before gdal_translate
==================================================<br>
ncdump -h MCBCP_BeachModel_UTM11N_Baseline.grdclip.nc<br>
netcdf MCBCP_BeachModel_UTM11N_Baseline.grdclip {<br>
dimensions:<br>
x = 12626 ;<br>
y = 12251 ;<br>
variables:<br>
double x(x) ;<br>
x:long_name = "Easting (meters)" ;<br>
x:actual_range = 444057.827834802,
469309.046567392 ;<br>
double y(y) ;<br>
y:long_name = "Northing (meters)" ;<br>
y:actual_range = 3670183.00468016,
3694684.53612513 ;<br>
float z(y, x) ;<br>
z:long_name = "Topography (m)" ;<br>
z:_FillValue = NaNf ;<br>
z:actual_range = -1995.541015625, 599.818359375 ;<br>
<br>
// global attributes:<br>
:Conventions = "COARDS/CF-1.0" ;<br>
:title = "Topography Grid" ;<br>
:history = "grdclip -V
/media/EXT4_Projects_01/SLR_Data/level1/MCBCP/Basemap/MCBCP_BeachModel_UTM11N_Baseline.grd
-G/media/EXT4_Projects_01/SLR_Data/level1/MCBCP/Basemap/MCBCP_BeachModel_UTM11N_Baseline.grdclip.nc
-Sa600/NaN -Sb-2000/NaN" ;<br>
:description = "\n",<br>
"\tProjection: UTM11N\n",<br>
"\tGrid created by mbgrid\n",<br>
"\tMB-system Version 5.3.1982\n",<br>
"\tRun by <hellyj> on
<StonestepsLinux> at <Thu Apr 25 19:44:41
2013>" ;<br>
:GMT_version = "4.5.9_r9909 [64-bit]" ;<br>
}<br>
=====================================Output from mbgrid
after gdal_translate
====================================================<br>
ncdump -h
MCBCP_BeachModel_UTM11N_Baseline.grdclip.flipped.nc<br>
netcdf MCBCP_BeachModel_UTM11N_Baseline.grdclip.flipped {<br>
dimensions:<br>
side = 2 ;<br>
xysize = 154681126 ;<br>
variables:<br>
double x_range(side) ;<br>
x_range:units = "meters" ;<br>
double y_range(side) ;<br>
y_range:units = "meters" ;<br>
double z_range(side) ;<br>
z_range:units = "meters" ;<br>
double spacing(side) ;<br>
int dimension(side) ;<br>
float z(xysize) ;<br>
z:scale_factor = 1. ;<br>
z:add_offset = 0. ;<br>
z:node_offset = 1 ;<br>
<br>
// global attributes:<br>
:title = "" ;<br>
:source = "" ;<br>
}<br>
<br>
<pre class="moz-signature" cols="72">--
John Helly, University of California, San Diego / San Diego Supercomputer Center / Scripps Institution of Oceanography / 760 840 8660 mobile / stonesteps (Skype) / stonesteps7 (iChat) / <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.sdsc.edu/%7Ehellyj">http://www.sdsc.edu/~hellyj</a></pre>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
John Helly, University of California, San Diego / San Diego Supercomputer Center / Scripps Institution of Oceanography / 760 840 8660 mobile / stonesteps (Skype) / stonesteps7 (iChat) / <a class="moz-txt-link-freetext" href="http://www.sdsc.edu/~hellyj">http://www.sdsc.edu/~hellyj</a></pre>
</body>
</html>