Re: writing to a netcdf file

From: Marston Johnston <shejo284_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 19 2014 - 05:00:17 MST

Hi,

Here are a few examples of how to output your data to a netcdf file in NCL.

http://www.ncl.ucar.edu/Applications/o-netcdf.shtml

The methods available depends on how efficient you want your script to be.
The easiest method takes a long time to write data to a netcdf file. Faster
ways require you to predefine your variables before writing them to the
file. It's a bit more coding but helps you to better understand NCL and
netcdf file conventions.

Good luck!

/M

On Wed, Feb 19, 2014 at 12:23 PM, Steeven Paul Yerraguntla <
steevenpaul@gmail.com> wrote:

> Dear seniors,
> This is to a query regarding how to write the filtered data,
> which was extracted using one of NCL filters, to a netcdf file without
> loosing the time axis and lat and lon information. In the following example
> ncl file, i want to write the *xBPF* variable without loosing time axis
> etc., to a netcdf file. Thanks in advance for the solution.
>
>
> ******************************************************************************************
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> begin
>
> diri = "/Users/shea/Data/AMWG/"
> vName = "U_anom" ; name of variable on the file
> fili = "uwnd.day.850.anomalies.1980-2005.nc"
> f = addfile(diri+fili, "r")
> x = f->$vName$(:,{0},{120})
>
> ; ***********************************************
> ; create the filter weights and apply
> ; ***********************************************
>
> ihp = 2 ; band pass
> sigma = 1.0 ; Lanczos sigma
>
> nWgt = 201 ; loose 100 each end
> fca = 1./100. ; start freq
> fcb = 1./20. ; last freq
> wgt = filwgts_lanczos (nWgt, ihp, fca, fcb, sigma )
> *xBPF * = wgt_runave ( x, wgt, 0 ) ; 20-100 day
>
>
> *************************************************************************************************
>
> regards,
> Paul.
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

-- 
Only the fruitful thing is true!

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 19 05:00:31 2014

This archive was generated by hypermail 2.1.8 : Wed Feb 19 2014 - 15:58:35 MST