Dear Dennis,
Thank you for your help and making my code efficient.
1) I have tried on both 5.1.1 and 6.0.0-beta versions
2) Now, I have allocated the memory and modified following your suggestions.
Still I am getting the same error.
fatal:relhum: If one _FillValue attribute is set, then all of them must be set.
fatal:Execute: Error occurred at or near line 45 in file rel_humid.ncl
Is it like, when I use 'conform', the attributes also should be set? I have uploaded the data and the script.
Phani
----- Original Message -----
From: "Dennis Shea" <shea@ucar.edu>
To: "R Phani" <rphani@tropmet.res.in>, "NCL" <ncl-talk@ucar.edu>
Sent: Saturday, November 9, 2013 9:47:47 AM
Subject: Re: FillValue attributes
[1] What version of NCL are you using?
%> ncl -V
[2] Where have you allocated memory for 'rh'. In your code,
I would have expected to see:
rh = new (dimsizes(temp_cfs), typeof(temp_cfs))
[3] Your code could be made more efficient.
[a] Whenever an entire variable is being read don't use (:,:,:,:).
NCL accesses the data more efficiently without the (:,:,:,:).
In practice, you will likely not notice any speed difference.
temp_spcfs = f1->TMP_GDS0_ISBL_10 ; (:,:,:,:)
sp_spcfs = f2->SPF_H_GDS0_ISBL_10
temp_cfs = f3->TMP_GDS0_ISBL_10
sp_cfs = f4->SPF_H_GDS0_ISBL_10
[b] NCL is an interpreted language. Generally, it is better to
avoid 'do' loops. NCL has 2 functions which can be used to
replace your do loop
http://www.ncl.ucar.edu/Document/Functions/Built-in/conform.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/conform_dims.shtml
Replace
rh = new(dimsizes(temp_cfs),typeof(temp_cfs)) ; added for correctness
do k = 1,nlevs
do j = 1, nlon
do i = 1,nlat
pPa = levs(k)*100
rh(i, j, k) = relhum (t_spcfs(i,j,k), sph_spcfs(i,j,k), pPa)
end do
end do
end do
With
rh = relhum (t_spcfs, sph_spcfs, conform(t_spcfs, levs*100, 1)
There is no need to preallocate space for 'rh'. rh will be created
automatically.
------------
If you are new to NCL, please read the Mini-Language Manual at:
http://www.ncl.ucar.edu/Document/Manuals/
On 11/9/13 6:59 AM, R Phani wrote:
> Hi NCL users,
>
> I am getting the following error.
>
> fatal:relhum: If one _FillValue attribute is set, then all of them must be set.
> fatal:Execute: Error occurred at or near line 45 in file rel_humid.ncl
>
> What could be the problem in the script?
>
> Phani
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Nov 9 09:37:28 2013
This archive was generated by hypermail 2.1.8 : Mon Nov 11 2013 - 09:45:33 MST