[gdal-dev] How to change variable names in netCDF?
blaa_katt at yahoo.co.jp
blaa_katt at yahoo.co.jp
Thu Apr 19 10:09:36 EDT 2012
Normal 0 false false false EN-US JA X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}
Hello,
Thank you for the reply, Etienne.
If it is impossible with the gdal 1.9.0,I would like to implement some modifications.
We found netCDF constructor in netcdfdataset.cpp.
I think it is possible to modify the names by setting pszBandNameas shown follows:
---------------------------------------------------
if (!pszBandName || EQUAL(pszBandName,"") )
sprintf( szTemp, "Band%d", nBand );
else
strcpy( szTemp, pszBandName );
CPLDebug( "GDAL_netCDF","nc_def_var(%d,%s,%d)",
cdfid, szTemp,nc_datatype );
status = nc_def_var( cdfid, szTemp,nc_datatype,
NCDF_NBDIM,anBandDims, &nZId );
But the course of the modification is unclear for me.
Can anyone give me any advice which way is better, (e.g. parsing of names through string options,making reserved metadata with a name, modification of Python APIs, etc)?
Kind regards,
Asuka
Etienne Tourigny <etourigny.dev at gmail.com> wrote:
If you use gdal-1.9 the driver will use the variable name from the
original netcdf file (if any).
for example, if you use the following command the original filename
will be preserved.
gdal_translate -of netcdf in.nc out.nc
However, if copying from other formats (such as gtiff), or creating a
new netcdf file, there is no way to change the variable name with
gdal.
You can use other tools such as:
NCO -> nco.sourceforge.net/
cdo ->https://code.zmaw.de/projects/cdo
Etienne
On Thu, Apr 19, 2012 at 5:15 AM, <blaa_katt at yahoo.co.jp> wrote:
> Hello everybody,
>
> I have a question about netCDF creation.
> I am using GDAL 1.9.0 in python.
>
> Creation Issues in http://www.gdal.org/frmt_netcdf.html mentions
> “each variable array is names Band1, Band2,… ”.
>
> I would like to change the names.
> Can anyone give me ideas?
>
> Thank you for your time.
>
> Kind regards,
>
> Asuka
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120419/46095166/attachment-0001.html
More information about the gdal-dev
mailing list