[ncl-talk] Dimension error while saving file.
USHNANSHU DUTTA
ushnanshudutta at gmail.com
Fri Jul 19 01:52:12 MDT 2019
Hi,
I have computed climatology using smooth climatology function.
While saving the file the time is coming in "lev" dimension instead of time
dimension like this
1> ./cfsr_clim.nc (default)
name title I J K L
M N
*QNET Daily Climatology 1:80 1:60 1:366
... ... ...*
I want 1:366 to be in "L"
any possible wayout?
*below is the script*
load "/usr/local/ncl/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "/usr/local/ncl/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "/usr/local/ncl/lib/ncarg/nclscripts/csm/contributed.ncl"
load "/usr/local/ncl/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin
b = addfile("cfsr_qnet_new.nc","r")
cqnet1= (b->QNET)
cqnet1!0="time"
cqnet1!1="lat"
cqnet1!2="lon"
f1=addfile("/run/media/iitm/VEERU/manuscritp1/final_2019/landsea.nc","r")
lsdata1 = f1->LSMASK
;printVarSummary(lsdata)
lsm1 = landsea_mask(lsdata1,cqnet1&lat,cqnet1&lon)
cqnet = mask(cqnet1,lsm1.eq.1,False)
copy_VarCoords(cqnet1,cqnet)
ymdStrt = 20000101 ; start yyyymmdd
ymdLast = 20091231 ; last
yrStrt = ymdStrt/10000
yrLast = ymdLast/10000
nhar = 4 ; number of fourier comp
;***********************************************************
; Read user specified time and create required yyyyddd
;***********************************************************
time = b->TIME ; all times on file
ymd = cd_calendar(time, -2) ; yyyymmdd
iStrt = ind(ymd.eq.ymdStrt) ; index start
iLast = ind(ymd.eq.ymdLast) ; index last
delete(time)
delete(ymd)
;***********************************************************
; Read user specified time and create required yyyyddd
;***********************************************************
time = b->TIME(iStrt:iLast) ; time:units = "hours since"
TIME = cd_calendar(time, 0) ; type float
year = floattointeger( TIME(:,0) )
month = floattointeger( TIME(:,1) )
day = floattointeger( TIME(:,2) )
ddd = day_of_year(year, month, day)
yyyyddd = year*1000 + ddd ; needed for input
;***********************************************************
; Compute daily climatology:
;***********************************************************
cqnet_clim = clmDayTLL(cqnet, yyyyddd) ; daily climatology at CI box
printVarSummary(cqnet_clim)
;***********************************************************
; Compute smoothed daily climatology using 'nhar' harmonics
;***********************************************************
cqnet_clim_sm = smthClmDayTLL(cqnet_clim, nhar)
printVarSummary(cqnet_clim_sm)
tim=cqnet_clim_sm&year_day
printVarSummary(tim)
cqnet_clim_sm!0 = "tim"
setfileoption("nc","Format","NetCDF4Classic")
fnc = "cfsr_clim.nc"
system("/bin/rm -f "+fnc) ; rm any pre-existing file
fout = addfile(fnc, "c") ; new netCDF file
fout->qnet = cqnet_clim_sm
end
--
*Ushnanshu Dutta*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190719/abcbaabe/attachment.html>
More information about the ncl-talk
mailing list