Another route that does not involve recompiling GRASS is to write a Python script to export the data from GRASS into an ASCII format, read the data into a numeric python array (NumPy) and then use the included netCDF module in NumPy to create your netCDF:
<br><br><a href="http://www-md.fsl.noaa.gov/eft/developer/netCDFPythonInterface.html">http://www-md.fsl.noaa.gov/eft/developer/netCDFPythonInterface.html</a><br><br><br><br><div><span class="gmail_quote">On 6/26/06, <b class="gmail_sendername">
Nagesh Bhatkar</b> <<a href="mailto:bnagesh@nio.org">bnagesh@nio.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Copy the r.out.netcdf module into the ~/grass-6.0.0/raster/ source directory<br>Create a Makefile in the r.out.netcdf directory if there doesnt exist<br>one, and then run<br>"make" . If the Makefile already exist, make sure -lnetcdf is added to
<br>the LIBES<br>The following is the Makefile:<br><br><br>MODULE_TOPDIR = ../..<br><br>PGM = r.out.netcdf<br><br>LIBES = $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) -lnetcdf<br>DEPENDENCIES= $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP)
<br><br>include $(MODULE_TOPDIR)/include/Make/Module.make<br><br>default: cmd<br><br><br><br><br><br><br><br><br><br><br>Hamish wrote:<br><br>>Barry Baker wrote:<br>><br>><br>><br>>>It has been nearly 16 years since I used Grass and now coming back.
<br>>>I have GRASS up and running on my Mac PowerBook G4 with OS X 10.4.6<br>>><br>>><br>><br>>!!<br>><br>><br>><br>>>Now I am trying to install the r.out.netcdf module and am at a loss as
<br>>>to how to go about it. Any help would be appreciated.<br>>><br>>><br>><br>>Unless r.out.netcdf is packaged for the new GRASS 6.1 Extension Manager<br>>(GEM), and I'm pretty sure it isn't, you will need the full grass source
<br>>code to compile it.<br>><br>>after ./configure, make of source code,<br>><br>>mkdir raster/r.out.netcdf/<br>>cd raster/r.out.netcdf/<br>>cp r.out.netcdf_source_files/* .<br>>make<br>><br>>
<br>>alternatively and probably simpler, use r.out.gdal for NetCDF output:<br>><br>>GRASS> gdalinfo --formats<br>> GMT (rw): GMT NetCDF Grid Format<br>> netCDF (ro): network Common Data Format<br>><br>
>In my old version of GDAL, the GMT version is only one which it can<br>>write to. I'm not sure what the latest version can do.<br>><br>><a href="http://www.gdal.org/formats_list.html">http://www.gdal.org/formats_list.html
</a><br>><br>>another indirect way is to use r.out.mat to make a Matlab array and<br>>to save a NetCDF file from there. (r.out.mat is untested on big-endian<br>>AFAIK, if that doesn't work use raw r.out.bin -> Matlab)
<br>><br>>If you are looking to send output to GMT, there are other options &<br>>scripts that can be used. see r.out.gmt on the wiki add-ons page and:<br>> <a href="http://169.237.35.250/~dylan/grass_user_group/#GMT_and_GRASS-overview">
http://169.237.35.250/~dylan/grass_user_group/#GMT_and_GRASS-overview</a><br>><br>><br>><br>>Hamish<br>><br>>_______________________________________________<br>>grassuser mailing list<br>><a href="mailto:grassuser@grass.itc.it">
grassuser@grass.itc.it</a><br>><a href="http://grass.itc.it/mailman/listinfo/grassuser">http://grass.itc.it/mailman/listinfo/grassuser</a><br>><br>><br>><br>><br><br>_______________________________________________
<br>grassuser mailing list<br><a href="mailto:grassuser@grass.itc.it">grassuser@grass.itc.it</a><br><a href="http://grass.itc.it/mailman/listinfo/grassuser">http://grass.itc.it/mailman/listinfo/grassuser</a><br></blockquote>
</div><br><br clear="all"><br>-- <br>David Finlayson