[ncl-talk] Era-Interim daily precipitation

Ehsan Taghizadeh ehsantaghizadeh at yahoo.com
Fri Jun 8 08:31:19 MDT 2018


 Dears,I did some editions on previous script, and it seems works better.However the problem about time dimensions. I'll be thankful if discard previous script and for any help about new attached file.
SincerelyEhsan
    On Friday, June 8, 2018, 5:54:04 PM GMT+4:30, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:  
 
  Dear Dennis,
Thank you so much for your script.In your script, "tp3_ncl" is exactly what I need, as its values are the same as "tp_cdo" values.However could I have any help to write this variable (tp3_ncl) in nc file, just like (tp) in (2_ERAI_Prec_2015_Jan_00_12_12.nc)?I've added between 185-218, I've attached the script. However it is absolutely wrong.

I'll be thankful for any help.
SincerelyEhsan

    On Tuesday, June 5, 2018, 4:26:15 AM GMT+4:30, Dennis Shea <shea at ucar.edu> wrote:  
 
 I am going to add a few more items to a previous response:

The Golden Rules of data processing are:

(a) Look at your data!
(b) Know your data!
(c) Make sure *you* know what a function or tool is doing to your data
---

The source netcDF '2_2_ERAI_Prec_2015_Jan_00_12_ 12.nc' was created from a GRIB file:

history attribute:
2018-05-16 09:15:25 GMT by grib_to_netcdf-2.7.3: grib_to_netcdf /data/data05/scratch/3c/71/_ma rs-atls00-a562cefde8a29a7288fa 0b8b7f9413f7-b4mPzK.grib -o /data/data04/scratch/41/14/_gr ib2netcdf-atls17-a562cefde8a29 a7288fa0b8b7f9413f7-PZaKeY.nc -utime" ;

---
There are 62 time steps on the source ERAI file:

                  yyyymmddhh     tp value
(0)    ERAI: 2015010112   0.000330344    <=== only one value for this calendar day

(1)    ERAI: 2015010200   0.0051588        ...... two time steps per calendar day ...
(2)    ERAI: 2015010212   0.00401913
(3)    ERAI: 2015010300   0
(4)    ERAI: 2015010312   0
(5)    ERAI: 2015010400   0
(6)    ERAI: 2015010412   0.000478998
(7)    ERAI: 2015010500   0.00344653
[SNIP]
(55)    ERAI: 2015012900   0
(56)    ERAI: 2015012912   0
(57)    ERAI: 2015013000   9.35942e-05
(58)    ERAI: 2015013012   7.15703e-05
(59)    ERAI: 2015013100   0.00390901
(60)    ERAI: 2015013112   0

(61)    ERAI: 2015020100   0.00183889      <=== only one value for this calendar day---
To what 'time' does the source ERAI 'time stamp apply"? 
That is ***USER RESPONSIBILITY*** to know or find the answer.

Three possibilities:

[1] beginning
[2] end
[3] 'center-of-mass'  ... mid temporal time?

---
NCL's 'calculate_daily_values' with 'ncrit=2' requires two values on the same calendar day
           https://www.ncl.ucar.edu/ Document/Functions/ Contributed/calculate_daily_ values.shtml

With ncrit=2 the function returns 30 values ... not 31 or 32. Why?
Because it requires 2 values per calendar date. It ignores the 1st and last times because there is only one time step per calendar day

tp2_ncl
  NCL_tag :     calculate_daily_values: arith=sum

     ----
The function 'tags' it with the 1st time step of each *complete*  calendar day

(0)     NCL: 2015010200   0.00917792
(1)     NCL: 2015010300   0
(2)     NCL: 2015010400   0.000478998
(3)     NCL: 2015010500   0.00879252
[SNIP]
(28)    NCL: 2015013000   0.000165164
(29)    NCL: 2015013100   0.00390901

---
The CDO takes the first two values [0,1], then the next two [2,3], etc. 
It 'tags' the time as the 2nd time step

(0)     CDO: 2015010200   0.00548913
(1)     CDO: 2015010300   0.00401912
(2)     CDO: 2015010400   -1.08611e-10
[SNIP]
(29)    CDO: 2015013100   0.00398058
(30)    CDO: 2015020100   0.00183889

Even though the time 'tags' are the same, they refer to different sums.
---
 
NCL can be made to handle the time and data any way the user wants.

I'll let you look at the attached script and output


On Fri, Jun 1, 2018 at 4:03 PM, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:

 Dears,About summation of 12 hours precipitation to obtain daily precipitation, as suggested me I used "cdo" and it seems work correctly:"cdo -b F32 -f nc4c -z zip timselsum,2 2_2_ERAI_Prec_2015_Jan_00_12_12.nc 2_2_ERAI_Prec_2015_Jan_24_cdo. nc4"However I like to know how writing nc files with "Geo2D".
SincerelyEhsan

    On Thursday, May 31, 2018, 7:12:17 PM GMT+4:30, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:  
 
  Thank you so much for your nice replies.With you comment, it seems work correctly. However I've added some changes to the script to have an output file same as input file, I mean about dimensions, attributes, and so on.However I have some difficulties about it and I'll be thankful if I could have your help, again.For example aboutfout->tp24_1!1 = tp!1fout->tp24_1!2 = tp!2I encountered error. It seems they have conflict with following lines:fout->latitude = fin->latitudefout->longitude = fin->longitude
Beside that I want to have "tp24_1" with dimension "Geo2D" to plot.I attached new version of script, and I'll be thankful if I hear from you.
SincerleyEhsan    On Thursday, May 31, 2018, 6:44:48 PM GMT+4:30, Dennis Shea <shea at ucar.edu> wrote:  
 
 The golden rule of  data processing is look at your data

You have:

tp=f->tp     ; <=== type 'short' [ packed data]

However, your file has:

      short tp ( time, latitude, longitude )
         scale_factor : 5.505649013956001e-06
         add_offset :   0.1803980955369768
         _FillValue :   -32767
         missing_value :        -32767
         units :        m
         long_name :    Total precipitation

You *MUST* unpack the variable before computing the sums.

tp = short2flt(f->tp)

printVarSummary(tp)
printMinMax(tp,0)

===
https://www.ncl.ucar.edu/ Document/Functions/ Contributed/short2flt.shtml

 




On Thu, May 31, 2018 at 7:19 AM, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:

 Dears,
I've tried sum 12 hour precipitation to obtain 24 hour precipitation using attached script.However it seems doesn't work correctly!I had to sum tp(0,:,:)+tp(1,:,:), also tp(2,:,;)+tp(3,;,:), and so on.I uploaded "2_2_ERAI_Prec_2015_Jan_00_12_ 12.nc" in ftp.cgd.ucar.edu.I'll be thankful if I hear from you.
SincerelyEhsan
    On Wednesday, May 16, 2018, 8:23:32 AM GMT+4:30, Dennis Shea <shea at ucar.edu> wrote:  
 
 This is book keeping. Something like:

loop  each year
   loop each month
      loop each day
   
        sum all values occurring between 00:00 and 11:59 inclusive ==>PRC(time,lat,lon,0)
        sum all values occurring between 12:00 and 23:59 inclusive ==>PRC(time,lat,lon,1)

     end day
   end month
 end year


On Sun, May 13, 2018 at 9:07 AM, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:

Hi every body;Could I have any help to get daily precipitation from Era-Interim, please?I mean, a way to sum "accumulated precipitation from 00:00 to 12:00" with "accumulated precipitation from 12:00 to 24:00"?
SincerelyEhsan
______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/ mailman/listinfo/ncl-talk



  
______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/ mailman/listinfo/ncl-talk



    
______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/ mailman/listinfo/ncl-talk



    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180608/131fadb1/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prc_sum_write.ncl
Type: application/octet-stream
Size: 9463 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180608/131fadb1/attachment-0001.obj>


More information about the ncl-talk mailing list