[gradsusr] How to get four variables to a single output file...????

Muhammad Yunus Ahmad Mazuki ukm.yunus at gmail.com
Sun Oct 6 20:51:17 EDT 2013


Because you can combine string operands, You can combine the four variables
that were in different operands into one operands, and print that whole
string instead. Something like:

line.1=xlat.1+' '+x.lon.1+' 'temp.1+' 'ppt.1

Be sure to leave appropriate separator like spaces, or commas, depending
whether you want to save in binary, text or csv.


On Mon, Oct 7, 2013 at 6:56 AM, Andrew Friedman <andfried at berkeley.edu>wrote:

> Hi Uzair,
>
> I don't think that fprintf alone can make what you're looking for.
>
> I haven't done this, but two possible approaches come to mind:
> 1. You can combine the output of different variables from fprintf using an
> external text processing utility such as awk.
> 2. You can create a table from netcdf data directly using the NCO (netcdf
> operator) ncks:
> http://nco.sourceforge.net/nco.html#ncks-netCDF-Kitchen-Sink (see section
> 4.7.1: Filters for ncks)
>
> Can you describe more what you're using the table for? Others may be able
> to help with a better understanding of the specifics.
>
> Andrew
>
>
> On Oct 6, 2013, at 10:18 AM, uzair manan <uzair_july at hotmail.com> wrote:
>
> > GOOD MORNING EVERYONE:
> >
> > I've simulated global data using a regional climate model.. The output
> it generates is in netcdf format. The output file contains four variables
> which are :-
> > 1. Latitude (xlat)
> > 2. Longitude (xlon)
> > 3. Temperature (temp)
> > 4. Precipitation (ppt)
> >
> > Now how can I generate, using fprintf or any other way, a single file
> that contains a template as shown below:- (FOR EXAMPLE)
> >
> > LATITUDE              LONGITUDE                  TEMPERATURE
> PRECIPITATION
> >
> >     23                                 60
>         23                                        10mm
> >     23.5                              60.5
>      26                                        26mm
> >       .                                   .
>              .                                              .
> >       .                                   .
>              .                                              .
> >       .                                   .
>              .                                              .
> >
> > A format like above or anything similar to it will work. Please give an
> example
> >
> > Any help will be appreciated...
> >
> >
> >
> >
> >
> > Best regards
> >
> > Uzair Mannan
> > Cell: +923323489950
> > NED University of Engineering & Technology
> > Karachi, Pakistan
> >
> > _______________________________________________
> > gradsusr mailing list
> > gradsusr at gradsusr.org
> > http://gradsusr.org/mailman/listinfo/gradsusr
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20131007/284bc723/attachment.html 


More information about the gradsusr mailing list