[ncl-talk] error for nc to text

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Wed Sep 17 12:48:12 MDT 2014


Azizul,

We can not tell what kind of time coordinates are in your data file.  Your
solution will depend on the kind of time coordinates.

However, let's assume that you are starting with a Netcdf file with CF time
coordinates.  Please see example time_2.ncl on the NCL Time Coordinates
application example page, for how to read CF time coordinates from a Netcdf
file, and how to use the cd_calendar function to convert the CF time
coordinates to year, month, day, hour, etc.

Please see the NCL Output ascii application examples page, for how to write
a text file with columns of numbers.

You should not use ncks to first convert your Netcdf data to text.  This is
much more complicated than reading precipitation directly from the original
Netcdf file, using NCL.

--Dave

On Wed, Sep 17, 2014 at 12:20 PM, Md.Azizul Haque <haque.azizul320 at yahoo.com>
wrote:
>
>
> Hi Dave,
>
> Thanks and it now works. I got only precipitation value but I need the
txt file like this.
> pls help me
> Regards
> Azizul
> year                                    month                day
   precipitation
> 2006 1 1 0.00E+00
> 2006 1 2 4.77E-04
> 2006 1 3 4.41E-02
> 2006 1 4 3.92E-03
> 2006 1 5 0.00E+00
> 2006 1 6 0.00E+00
> 2006 1 7 1.47E-04
> 2006 1 8 2.41E-01
> 2006 1 9 3.96E-01
> 2006 1 10 7.78E-02
> 2006 1 11 4.74E-04
> 2006 1 12 8.51E-04
> 2006 1 13 6.12E-04
> 2006 1 14 0.00E+00
> 2006 1 15 0.00E+00
> 2006 1 16 0.00E+00
> 2006 1 17 0.00E+00
> 2006 1 18 0.00E+00
> 2006 1 19 0.00E+00
> 2006 1 20 0.00E+00
> 2006 1 21 0.00E+00
> 2006 1 22 0.00E+00
>
>
> On Tuesday, 16 September 2014, 15:52, Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:
>
> Azizul,
>
> Okay, I see another error in the command.  The -v option needs a variable
name following it.  You have only -v directly followed by a file name.
 This will confuse ncks into thinking that "pr_...nc" is a variable name,
and there is no input file.
>
> Simply insert the missing variable name such as "pr" after -v, and I
think it should work.  Or else, remove -v if you want to convert all
variables in the file.  Sorry I did not catch this before.
>
> --Dave
>
> On Tue, Sep 16, 2014 at 3:24 PM, azizul haque <haque.azizul320 at yahoo.com>
wrote:
> >
> > Hi Dave,
> > Thank you very much for your quick reply. Its work but I am getting
only string. not value
> >
> > any suggestion
> > regards
> > azizul
> > ncks: ERROR received 0 filenames; need at least one
> > ncks Command line options cheatsheet (full details at
http://nco.sf.net/nco.html#ncks):

<snip>

> > On Tuesday, 16 September 2014, 14:47, Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:
> >
> > Azizul,
> >
> > This command uses Unix output redirection.  You need a "greater than"
sign in front of the output file name, like this:
> >
> > ncks -s '%e \n' -C -v pr_day_cnrm-cm5_mean_sa.nc >
pr_day_cnrm-cm5_mean_sa.txt
> >
> > --Dave
> >
> > On Tue, Sep 16, 2014 at 2:18 PM, azizul haque <haque.azizul320 at yahoo.com>
wrote:
> > >
> > > Hi All,
> > > I am trying to convert nc time dimension to text using
> > >
> > >  ***ncks -s '%e \n' -C -v pr_day_cnrm-cm5_mean_sa.nc
pr_day_cnrm-cm5_mean_sa.txt***
> > >
> > > and getting following error
> > >
> > > ***ERROR file pr_day_cnrm-cm5_mean_sa.txt neither exists locally nor
matches remote filename patterns***
> > >
> > > Appreciated for your kind help
> > > regards
> > > Azizul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140917/42f33e4d/attachment.html 


More information about the ncl-talk mailing list