[ncl-talk] Problem with Time dimension after saving to netcdf file in NCL

Lyndz olagueralyndonmark429 at gmail.com
Thu Aug 29 23:20:03 MDT 2019


Dear Sir Dennis,

Thank you for the fast response.

I tried your suggestion for the first issue. However, the output still has
no time step.
I uploaded the file in my dropbox:

https://www.dropbox.com/s/o7f0wh6uhuamts0/aphro_1986_AMJ.nc?dl=0

Also attached is the updated script.

I am hoping for your kind help.

Sincerely,
Lyndz


On Thu, Aug 29, 2019 at 10:58 PM Dennis Shea <shea at ucar.edu> wrote:

> [1] It is likely that NCL's "dimension reduction"  is the issue.
> Generally, this is a "feature" on NCL. However, sometimes it requires some
> extra coding. You must use an 'if' to test. Maybe something like:
>
>    dimr = dimsizes(rain)
>    ntim = dimr(0)
>    nlat = dimr(1)
>    mlon = dimr(2)
>    if (ntim.eq.1) then
>        rain_aave = new ((/1,nlat,mlon/),
> typeof(rain_region),getVarFillVaalue(rain_region))
>        rain_aave(0,:,:) =wgt_areaave_Wrap(rain_region,1.0,1.0,0)
>    else
>        .rain_aave=wgt_areaave_Wrap(rain_region,1.0,1.0,0)
>   end if
>
> [2]
> undef("add_hyphen")
> function add_hyphen(yyyymmdd[*]:integer)
> local yyyy, mmdd, mm, dd
> begin
>    yyyy    = yyyymmdd/10000
>    mmdd = yyyymmdd-(yyyymmdd*10000)
>    mm     = mmdd/100
>    dd       = mmdd-(mm*100)
>    return(yyyy+"-"+mm+"-"+dd)
> end
>
>
>
> On Thu, Aug 29, 2019 at 4:19 AM Lyndz via ncl-talk <ncl-talk at ucar.edu>
> wrote:
>
>> Dear NCL-experts,
>>
>> I trying to run my script (attached in this email). There are two issues
>> that I would like to address and ask for help.
>>
>> *[1] The script runs but the output time dimension is incorrect when only
>> one-time step satisfies the conditions. For cases with multiple time steps
>> satisfying the conditions, the output is ok. Notice the time is 0 from the
>> ncdump below. Any ideas how to solve this issue?*
>>
>> Here's the ncdump of the output netcdf file when only one time-step
>> satisfies the coditions:
>> dimensions:
>>
>> time = UNLIMITED ; // (0 currently)
>> latitude = 280 ;
>> longitude = 360 ;
>> variables:
>> float rain(latitude, longitude) ;
>> rain:time = 116. ;
>> rain:level_description = "Earth surface" ;
>> rain:missing_value = -99.9f ;
>> rain:_FillValue = -99.9f ;
>> rain:units = "mm/day" ;
>> rain:long_name = "daily precipitation analysis interpolated onto 0.25deg
>> grids [mm/day]" ;
>> double latitude(latitude) ;
>> latitude:axis = "Y" ;
>> latitude:units = "degrees_north" ;
>> latitude:long_name = "Latitude" ;
>> latitude:standard_name = "latitude" ;
>> double longitude(longitude) ;
>> longitude:axis = "X" ;
>> longitude:units = "degrees_east" ;
>> longitude:long_name = "Longitude" ;
>> longitude:standard_name = "longitude" ;
>>
>> // global attributes:
>> :creation_date = "Thu Aug 29 18:28:59 JST 2019" ;
>> :Conventions = "None" ;
>> :source_file = "Daily Aphrodite Rainfall" ;
>> :title = "rain_stretch equal rain_threshold=0" ;
>> }
>>
>> *[2] One part of the script save the dates into a text file. Is there a
>> way to save the output file as YYYY-MM-DD separated by a dash (-) instead
>> of YYYYMMDD?*
>>
>> I'll appreciate any help about these.
>>
>> Sincerely,
>>
>> Lyndz
>>
>> _______________________________________________
>> 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/20190830/368eddae/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: date_filter.ncl
Type: application/octet-stream
Size: 2462 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190830/368eddae/attachment.obj>


More information about the ncl-talk mailing list