NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

[netcdf-java] compiler does not find the NetcdfFileWriter identifiers

  • To: "netcdf-java@xxxxxxxxxxxxxxxx" <netcdf-java@xxxxxxxxxxxxxxxx>
  • Subject: [netcdf-java] compiler does not find the NetcdfFileWriter identifiers
  • From: Beáta Szabó-Takács <szabo.b@xxxxxxxxxxxxx>
  • Date: Mon, 27 Jan 2020 18:31:27 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=czechglobe.cz; dmarc=pass action=none header.from=czechglobe.cz; dkim=pass header.d=czechglobe.cz; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OTnQXyKbrUVsV9aUSuOCulDvtDE12EiswIW7nemBDqU=; b=OJze3EmZT16fKQ3Cym5bIWMOBgDrJSaCddfh7YaQuCy/WwVBEggMjnraMs2uN60RlTV1swr1Qe5BMTE+qxP4jyBRD+URfhjeHA8fKKmTqVKtt+XtyGqT0LukNUu38DYzroyajR57hjFeq1xgz6c2TEXr7d1aO+220Ct5kXQAhMGvN3EpzfrWmnV7h2b2/AtkwinFHOytvdq0vbAv6KgCrb6vLtqMWcPkya7eTqDU2L7OBeuxDaelC5sxEwjjhU9ajqjZBi+Ju7+qQGi9BVEzief1By/EX/TQbcR6jc/lBllSpjkLmpd4YYNOgDGTWNSROcfErqRMb+30EQ0sz4KJog==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QmhGBFnLRjOdYkCmfu5OJMfGGjP+DX0SSnnWvaui97hpiWHFWOi/ITRG5h1wkgVH0DOsp6puUZzJC43EphmEG8PQbX6/5c7Pq9ROrzr0U7mIrSqcHn2PXm5bth6/MSxWWnquhnYmciong2HvI8VYd0hd7gx7PpE9Uy77VWoInJoUeclns5HTHY+vS0goQqSb6SwbVRVG/n2C/53xYRqGmNzrrepUUp/dp9vtrQrtu7wcJuBP2pkFXDDTHe/rQz2ImVdW8t2K6PCAnpaafYZgFp/804TgqlgQTrtty84rYbYLcmqQiY4Io+LpBpgpaPsw0rkBSgEQQre6+P3naP+jRA==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=szabo.b@xxxxxxxxxxxxx;
Dear netcdf-java Users,
In my previous email, I asked if there is a way to convert String variables to 
java code to build a NetCDF file from strings. I have some Strings which 
contain the commands to write a netCDF. For example:

String Variable contains the following strings:
'Variable time; '
'time = ncfile.addVariable(null, "time", DataType.Double, "time");'

String DataA contains:
'ArrayDouble.D1 timeData = new ArrayDouble.D1(countLinesResult); '
'Index ima = timeData.getIndex();'

String DataD contains:
'timeData.setDouble(ima.set(timeIdx),ValueD.get(timeIdx)); ' where ValueD is 
the data what are added to timeData array inside a for loop.

String DataNC contains:
'ncfile.write(time, timeData); '

each string is public static String. These stings are in NetCDF_writer Class 
static void getDataNc method.

I tried to convert them with InMemoryJavaCompiler 
(https://github.com/trung/InMemoryJavaCompiler) as:

NetcdfFileWriter ncfile = 
NetcdfFileWriter.createNew(NetcdfFileWriter.Version.netcdf4, location, null);
Dimension timeDim = ncfile.addUnlimitedDimension("time");
StringBuffer sourceCode = new StringBuffer();
                sourceCode.append("package meteoread;\n");
                sourceCode.append("public class NetCDF_writer {\n");
                sourceCode.append("   static void getDataNc(int id1, int id2, 
String listString, String location, String Stimenc, String ETimenc)throws 
Exception {" +Variables +" ncfile.create();" + "\n" + DataA + DataD + 
DataNC+"}");
                sourceCode.append("}");
                 Class<?> Netcdf_writer = 
InMemoryJavaCompiler.compile("meteoread.NetCDF_writer", sourceCode.toString());

Unfortunately, I got several cannot find symbol error messages. The compiler 
does not find the NetcdfFileWriter identifiers even though I imported 
ucar.nc2.* and ucar.ma2.* packages. Could someone write to me how I should fix 
this issue?
Thank you for your help in advance!
Kind regards,
Beata

Beáta Szabó-Takács Ph.D
Department of Atmospheric Matter Fluxes and Long-Range Transport
Global Change Research Institute CAS
Bělidla 986/4a
603 00 Brno
Czech Republic

+420 602 975 356
www.czechglobe.cz<http://www.czechglobe.cz>

  • 2020 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: