Hey Scott,<br><br>You could extract that layer from the netCDF, burn it with gdal_rasterize as a geotiff, convert the geoTiff into a GMT grid, and then possibly add that back into the netCDF (somehow).<br><br>Sounds like a pain though.<br>
<br>Roger<br>--<br><br><div class="gmail_quote">On Mon, Sep 21, 2009 at 11:49 AM, Scott Lewis <span dir="ltr"><<a href="mailto:scott.lewis@nsidc.org">scott.lewis@nsidc.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Ah, thanks. I must have missed that. Looks like I'll have to find<br>
another way to accomplish what I'm trying to do then!<br>
<br>
Thanks for your help!<br>
<font color="#888888"><br>
Scott<br>
</font><div><div></div><div class="h5"><br>
Hermann Peifer wrote:<br>
> The driver doesn't support updating netCDF files. gdalinfo --formats says:<br>
><br>
> GTiff (rw+): GeoTIFF<br>
> (...)<br>
> netCDF (rw): Network Common Data Format<br>
><br>
> The "+" indicates update support, which is obviously missing for netCDF<br>
> format.<br>
><br>
> Hermann<br>
><br>
><br>
> -------- Original Message --------<br>
> Subject: Re:gdal_rasterize with a NetCDF file?<br>
> From: Scott Lewis <<a href="mailto:scott.lewis@nsidc.org">scott.lewis@nsidc.org</a>><br>
> To: Date: 21/09/2009 20:37<br>
><br>
>> Evan,<br>
>><br>
>> Thanks, that seems to be getting me in the right direction: I'm no<br>
>> longer getting the segfault error, or "ERROR 5" at all.<br>
>><br>
>> However, now it's giving me a different error. The first line has the:<br>
>> 0...10...20...30...40...50...60...70...80...90...100 - done.<br>
>> message, like I would expect from when I do this with GeoTIFF files.<br>
>> But following that I am getting a whole bunch of this error, repeated<br>
>> many times:<br>
>><br>
>> ERROR 6: WriteBlock() not supported for this dataset.<br>
>><br>
>><br>
>> Doing a search online, I'm getting the impression that this might mean<br>
>> that gdal_rasterize doesn't support writing to a NetCDF file? Is this<br>
>> correct, or does the problem lie elsewhere with my calling of the<br>
>> utility.<br>
>><br>
>> Here's the command line I'm using now:<br>
>><br>
>> /usr/local/FWTools-2.0.6/bin_safe/gdal_rasterize -i -burn 0 -l<br>
>> "OGRGeoJSON" dummy.json<br>
>> 'NETCDF:"Albedo.nc":Albedo_with_1400_Local_Time_of_Measurement'<br>
>><br>
>><br>
>> Thanks again for the help!<br>
>><br>
>> Scott<br>
>><br>
>><br>
>> Even Rouault wrote:<br>
>>> Selon Scott Lewis <<a href="mailto:scott.lewis@nsidc.org">scott.lewis@nsidc.org</a>>:<br>
>>><br>
>>> Scott,<br>
>>><br>
>>> Anytime you want to access to a subdataset with a gdal utility, you<br>
>>> must use the<br>
>>> value of the relevant SUBDATASET_xxx_NAME metadata item, in that<br>
>>> instance<br>
>>> 'NETCDF:"Albedo.nc":Albedo_with_1400_Local_Time_of_Measurement'<br>
>>><br>
>>> The segmentation fault however wasn't expected, so I commited fixes<br>
>>> per ticket<br>
>>> <a href="http://trac.osgeo.org/gdal/ticket/3146" target="_blank">http://trac.osgeo.org/gdal/ticket/3146</a> to error out more nicely.<br>
>>><br>
>>> Best regards<br>
>>><br>
>>>> Hi,<br>
>>>><br>
>>>> I'm still fairly new at using GDAL, but I am having trouble burning a<br>
>>>> vector image onto a NetCDF file. I've had success with using<br>
>>>> gdal_rasterize to burn a vector onto a GeoTIFF file, but when I try to<br>
>>>> burn the same vector onto a NetCDF file, I get an error.<br>
>>>><br>
>>>> Based on the error, I'm suspecting it's because it doesn't know how to<br>
>>>> find the right "band" in the NetCDF File (I want the<br>
>>>> "Albedo_with_1400_Local_Time_of_Measurement" subdataset), but although<br>
>>>> I've looked at the documentation, I'm not sure how to specify this to<br>
>>>> gdal_rasterize.<br>
>>>><br>
>>>> Any help would be much appreciated! Below is the info.<br>
>>>><br>
>>>><br>
>>>><br>
>>>> Here is the command I am trying to run:<br>
>>>><br>
>>>> /usr/local/FWTools-2.0.6/bin_safe/gdal_rasterize -i -burn 0 -l<br>
>>>> "OGRGeoJSON" dummy.json Albedo.nc<br>
>>>><br>
>>>><br>
>>>> And the error I get:<br>
>>>><br>
>>>> ERROR 5: GDALDataset::GetRasterBand(1) - Illegal band #<br>
>>>><br>
>>>> /usr/local/FWTools-2.0.6/bin_safe/gdal_rasterize: line 9: 26950<br>
>>>> Segmentation fault $FWTOOLS_HOME/bin/`basename $TARGET` "$@"<br>
>>>><br>
>>>><br>
>>>><br>
>>>> Here is the gdalinfo for Albedo.nc:<br>
>>>><br>
>>>> Driver: netCDF/Network Common Data Format<br>
>>>> Files: Albedo.nc<br>
>>>> Size is 512, 512<br>
>>>> Coordinate System is `'<br>
>>>> Metadata:<br>
>>>> NC_GLOBAL#Conventions=CF-1.4<br>
>>>> NC_GLOBAL#institution=National Snow & Ice Data Center, Boulder, CO<br>
>>>> NC_GLOBAL#title=AVHRR Polar Pathfinder Twice-Daily 5 km EASE-Grid<br>
>>>> Composites Albedo<br>
>>>> NC_GLOBAL#source=See the title and references for this information<br>
>>>> NC_GLOBAL#comment=Not set at this time<br>
>>>> NC_GLOBAL#references=Documentation available at:<br>
>>>> <a href="http://nsidc.org/data/docs/daac/nsidc0066_avhrr_5km.gd.html" target="_blank">http://nsidc.org/data/docs/daac/nsidc0066_avhrr_5km.gd.html</a><br>
>>>> NC_GLOBAL#history=Mon, 21 Sep 2009 09:31:24: File created.<br>
>>>> Subdatasets:<br>
>>>><br>
>>>><br>
>>> SUBDATASET_1_NAME=NETCDF:"Albedo.nc":Albedo_with_1400_Local_Time_of_Measurement<br>
>>><br>
>>>> SUBDATASET_1_DESC=[1x244x242]<br>
>>>> Albedo_with_1400_Local_Time_of_Measurement (8-bit integer)<br>
>>>> SUBDATASET_2_NAME=NETCDF:"Albedo.nc":latitude<br>
>>>> SUBDATASET_2_DESC=[244x242] latitude (64-bit floating-point)<br>
>>>> SUBDATASET_3_NAME=NETCDF:"Albedo.nc":longitude<br>
>>>> SUBDATASET_3_DESC=[244x242] longitude (64-bit floating-point)<br>
>>>> Corner Coordinates:<br>
>>>> Upper Left ( 0.0, 0.0)<br>
>>>> Lower Left ( 0.0, 512.0)<br>
>>>> Upper Right ( 512.0, 0.0)<br>
>>>> Lower Right ( 512.0, 512.0)<br>
>>>> Center ( 256.0, 256.0)<br>
>>>><br>
>>>><br>
>>>> And for completeness, the dummy.json file (it's basically a triangle):<br>
>>>><br>
>>>> {<br>
>>>> "type": "FeatureCollection",<br>
>>>> "features": [{<br>
>>>> "type": "Feature",<br>
>>>> "properties": { "BASIN_ID": 1.000000, "AREA_SQKM":<br>
>>>> 1739.016470 },<br>
>>>> "geometry": {<br>
>>>> "type": "Polygon",<br>
>>>> "coordinates": [ [<br>
>>>> [ -2000000, -2500000 ],<br>
>>>> [ -2500000, -1400000 ],<br>
>>>> [ -1500000, -1400000 ],<br>
>>>> [ -2000000, -2500000 ]<br>
>>>> ] ]<br>
>>>> }<br>
>>>> }]<br>
>>>> }<br>
>>>><br>
>>>><br>
>>>><br>
>>>> Thanks!<br>
>>>><br>
>>>> Scott Lewis<br>
>>>> National Snow & Ice Data Center<br>
>>>> _______________________________________________<br>
>>>> gdal-dev mailing list<br>
>>>> <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
>>>> <a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
>>>><br>
>>><br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></div></blockquote></div><br>