This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Birgit, > To: <address@hidden> > From: "Birgit Heese" <address@hidden> > Subject: netcdf data problem > Organization: MIM The above message contained the following: > I have a problem in replacing some variables in a netcdf-file. I am = > getting some additional zeros at the end of the data. I am just opening = > the file and cheching the variable id and then putting a new value for = > this variable. I am not manipulating the data itselv at all. = > Nevertheless, the program is adding zeros behind the data.=20 > > inside a loop for jfil I am doing:=20 > > *************************************************************************= > ***************************** > > retint =3D nf_open = > (trim(mess_dir)//jahr_dir//"spo_data\"//sub_dir//filename(jfil)//".adf", = > nf_write, adf_unit) > =20 > alt=3Daltitude(jfil) > lat=3Dlatitude(jfil) > lon=3Dlongitude(jfil) > retint =3D nf_inq_varid (adf_unit, "altitude", var_id(1)) > retint =3D nf_put_var_real (adf_unit, var_id(1),alt) > > retint =3D nf_inq_varid (adf_unit, "latitude", var_id(2)) > retint =3D nf_put_var_real (adf_unit, var_id(2),lat) > > retint =3D nf_inq_varid (adf_unit, "longitude", var_id(3)) > retint =3D nf_put_var_real (adf_unit, var_id(3),lon) > > retint =3D nf_close (adf_unit) > > ********************************************************************* > > I send you one file before this procedure (*.adfold) and one file after = > replacing the three variables (*.adfnew) .=20 > > Thanks for a hint!=20 I'm afraid that I don't understand the problem. The files that you sent me have only the following differences: $ ncdump 1112222623.adfnew >new $ ncdump 1112222623.adfold >old $ diff -c old new | less *** old Tue Nov 18 08:38:40 2003 --- new Tue Nov 18 08:38:34 2003 *************** *** 130,140 **** trigger_bin = 1 ; ! altitude = 0 ; ! latitude = 3 ; ! longitude = 52 ; deltar_bin = 1 ; --- 130,140 ---- trigger_bin = 1 ; ! altitude = 2 ; ! latitude = 0 ; ! longitude = -0 ; deltar_bin = 1 ; In other words, the only differences between the file are the values of the variables that the code changed. This is how it should be. > Kind regards, > > Birgit Heese > -- > > Dr. Birgit Heese > =20 > Meteorological Institute Univ. of Munich > Department Radiation and Remote Sensing > Theresienstr. 37=20 > 80333 Munich > Germany=20 > > Tel: +49 89 2180 4608 > Fax: +49 89 2180 4381 > Email: address@hidden > Internet: = > http://www.meteo.physik.uni-muenchen.de/strahlung/lidar/polis/polis_index= > _pub.htm Regards, Steve Emmerson