Sponsored Content
Top Forums Programming ASCII to netcdf conversion..in C programming Post 302738961 by drl on Monday 3rd of December 2012 08:21:50 AM
Old 12-03-2012
Hi.

Googling netcdf produced a number of hits. One of which at NCAR/UCAR contained this:
Quote:
How do I convert ASCII or text data to netCDF?

One way to convert data in text form to netCDF is to use the ncgen tool that is part of the netCDF software distribution. Using ncgen for this purpose is a two-step process:

Convert text data to a file in CDL form using a text editor or text manipulation tools
Convert the CDL representation to netCDF using the ncgen tool with the "-o" or "-b" option
For more information, see the ncgen documentation.

If you have installed the NCAR Command Language (NCL) software, there are functions available and described here and here for reading ASCII and tables into NCL and writing the data out to netCDF files.

With access to MATLAB, you can create a schema for the desired netCDF file using ncwriteschema, read the data using textscan, and write the data to a netCDF file using ncwrite.
-- excerpt from: NetCDF FAQ, q.v.

I have not used netCDF, but this looks straight-forward if you have the appropriate codes installed.

To do this in C (more likely C++) would probably require that you mimic the codes cited. Probably better to use the suggestions of NCAR/UCAR if you can.

Observation: this appears to be a problem that is in the realm of specialists. I would guess that few people here are in that category, but I've been wrong before and will be again.

Best wishes ... cheers, drl
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ascii conversion

after converting my ebcidic file to ascii i get the following output 2097152+0 records in 1797345+1 records out Why is there a difference in number of records. Is the converson chopping off any records. All i am doing is just a conversion using the following script dd if=xaa cbs=152 ... (0 Replies)
Discussion started by: rintingtong
0 Replies

2. Shell Programming and Scripting

ascii to ebcdic conversion

Hello, I need a program for ascii to ebsdic conversion. If anybody can help, it'll be greatly appreciated. Thanks. (1 Reply)
Discussion started by: er_ashu
1 Replies

3. Shell Programming and Scripting

help needed with ASCII conversion

I have a file say "codefile" here ,contains data like this Hi! How are you? I need to covert this data into stram of equivalant ASCII values I wrote follwoing script. #!/bin/bash while read -n1 char do printf "%d" \'$char done < codefile this gives me output ... (4 Replies)
Discussion started by: sunilmenhdiratt
4 Replies

4. Shell Programming and Scripting

need help with ascii to decimal conversion

Hi, Can anyone please help me ascci to decimal conversion in bash I have a file which contains stream of numbers like this,these are ascci values 729711810132973278105991013268971213233 I want to covert it to its actual value like upper code's decimal is "Have a Nice Day!" ... (15 Replies)
Discussion started by: sunilmenhdiratt
15 Replies

5. UNIX for Dummies Questions & Answers

Conversion from EBCDIC to ASCII

when i try to convert a mainframe EBCDIC file to ASCII ,i dont see correct file this is the source file ... (3 Replies)
Discussion started by: venkatvelpula
3 Replies

6. Shell Programming and Scripting

binary to ascii conversion

Hi, I have got a library file, created by compiling C code. The file information with "file" command, gives it a "application/x-archive" type file. I want to extract the release string of my software from this file, so that i can know which version of C files were used to create the lib. Can... (3 Replies)
Discussion started by: atulmt
3 Replies

7. Shell Programming and Scripting

ASCII to UTF-8 conversion

I Am trying to change the file encoding from ASCII to UTF-8 using below command iconv -f ASCII -t UTF-8 <input_file> > <output_file> But the output_file is not actually in UTF-8 format. If I use the file command to check the file encoding it still says ASCII. While converting am not... (5 Replies)
Discussion started by: Sriranga
5 Replies

8. UNIX for Advanced & Expert Users

EBCDIC to ASCII conversion

Hi, We have a mainframe file which is in EBCDIC format.We dont have direct access to mainframe ,client has provided us the mainframe file.The mainframe file is containing pact data(COMP1 ,COMP2 etc) which are unreadble.Can anyone suggest me how to convert this kind of ebcdic file to ascii... (11 Replies)
Discussion started by: swapna_1990
11 Replies
NCO(1)							      General Commands Manual							    NCO(1)

NAME
NCO - netCDF Operators SYNTAX
operator [ options] input-files output-file DESCRIPTION
The netCDF Operators, or NCO are a suite of programs known as operators. Each operator is a standalone, command line program which is exe- cuted at the UNIX shell-level like, e.g., ls or mkdir. The operators take netCDF (<http://www.unidata.ucar.edu/packages/netcdf>) files as input, then perform a set of operations (e.g., deriving new data, averaging, hyperslabbing, or metadata manipulation) and produce a netCDF file as output. The operators are primarily designed to aid manipulation and analysis of gridded scientific data. The single command style of NCO allows users to manipulate and analyze files interactively and with simple scripts, avoiding the overhead (and some of the power) of a higher level programming environment. The NCO User's Guide illustrates their use with examples from the field of climate mod- eling and analysis. The available operators are: ncap2, netCDF Arithmetic Processor ncatted, netCDF Attribute Editor ncbo, netCDF Binary Operator (includes ncadd, ncsubtract, ncmultiply, ncdivide) ncea, netCDF Ensemble Averager ncecat, netCDF Ensemble Concatenator ncflint, netCDF File Interpolator ncks, netCDF Kitchen Sink ncpdq, netCDF Permute Dimensions Quickly, Pack Data Quietly ncra, netCDF Record Averager ncrcat, netCDF Record Concatenator ncrename, netCDF Renamer ncwa, netCDF Weighted Averager. (Note that the "averagers" are misnamed because they perform many non-linear operations as well, e.g., total, minimum, maximum, RMS). The operators are as general as netCDF itself: there are no restrictions on the contents of the netCDF file(s) used as input. NCO's inter- nal routines are completely dynamic and impose no limit on the number or sizes of dimensions, variables, and files. NCO is designed to be used both interactively and with large batch jobs. The default operator behavior is often sufficient for everyday needs, and there are numerous command line (i.e., run-time) options, for special cases. NCO works well on all modern operating systems. AUTHOR
NCO manual pages written by Charlie Zender and Brian Mays. REPORTING BUGS
Report bugs to <http://sf.net/bugs/?group_id=3331>. COPYRIGHT
Copyright (C) 1995-2010 Charlie Zender This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. SEE ALSO
The full documentation for NCO is maintained as a Texinfo manual called the NCO User's Guide. Because NCO is mathematical in nature, the documentation includes TeX-intensive portions not viewable on character-based displays. Hence the only complete and authoritative versions of the NCO User's Guide are the PDF (recommended), DVI, and Postscript versions at <http://nco.sf.net/nco.pdf>, <http://nco.sf.net/nco.dvi>, and <http://nco.sf.net/nco.ps>, respectively. HTML and XML versions are available at <http://nco.sf.net/nco.html> and <http://nco.sf.net/nco.xml>, respectively. If the info and NCO programs are properly installed at your site, the command info nco should give you access to the complete manual, except for the TeX-intensive portions. ncap2(1), ncatted(1), ncbo(1), ncdiff(1), ncea(1), ncecat(1), ncflint(1), ncks(1), nco(1), ncpdq(1), ncra(1), ncrcat(1), ncrename(1), ncwa(1) HOMEPAGE
The NCO homepage at <http://nco.sf.net> contains more information. NCO(1)
All times are GMT -4. The time now is 09:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy