Thanks Charlie for taking time to answer. Thank you Henry for finding a way ; the script below works fine : #!/bin/bash # Input and output file names input_file="RAINNC.nc" output_file="processed_RAINNC.nc" # Start time counter start_time=$(date +%s) # NCO script content nco_script=$(cat << 'END_SCRIPT' t2=array(0.0,1.0,$Time); t2@units="hours since 2013-09-30 14:00:00"; sz=$Time.size; for(idx=0;idx<sz;idx++) Times(idx,:)=sprint(strftime(t2(idx),"%Y-%m-%d_%H:%M:%S")); END_SCRIPT ) # Execute NCO script...
Thanks Charlie for taking time to answer. Thank you Henry for finding a way ; the script below works fine : #!/bin/bash # Input and output file names input_file="RAINNC.nc" output_file="processed_RAINNC.nc" # Start time counter start_time=$(date +%s) # NCO script content nco_script=$(cat << 'END_SCRIPT' t2=array(0.0,1.0,$Time); t2@units="hours since 2013-09-30 14:00:00"; sz=$Time.size; for(idx=0;idx<sz;idx++) Times(idx,:)=sprint(strftime(t2(idx),"%Y-%m-%d %H:%M:%S")); END_SCRIPT ) # Execute NCO script...
Hello, I've been looking at shifting time in WRF outputs files. For example, I would like to shift date-time from UTC to UTC-10. The time format in those files is a string of characters as seen below : nctime wrfout_d02_2013-10-01_00\:00\:00 |tms |head -n 5 "2013-10-01_00:00:00", "2013-10-01_01:00:00", "2013-10-01_02:00:00", "2013-10-01_03:00:00", "2013-10-01_04:00:00", Also see below the header information for relevant dimension and variable names : nch wrfout_d02_2013-10-01_00\:00\:00 |head -n...
Thanks so much, Henry! I wouldn't have found this in a million years. The second solution works well : # Loop over time steps for time_idx in $(seq 0 $((timesteps - 1))); do # Loop over latitude indices for lat_idx in $(seq $start_lat_idx $end_lat_idx); do ncap2 -h -O -s 'global@tmp=array(SST('${time_idx}','${lat_idx}',31),(SST('${time_idx}','${lat_idx}',80)-SST('${time_idx}','${lat_idx}',31))/50,$west_east); SST('${time_idx}','${lat_idx}',31:80)=global@tmp(0:49);' $output_file $output_file done...
Thanks so much, Henry! I wouldn't have found this in a million years. The second solution works well : # Loop over time steps for time_idx in $(seq 0 $((timesteps - 1))); do # Loop over latitude indices for lat_idx in $(seq $start_lat_idx $end_lat_idx); do ncap2 -O -s 'global@tmp=array(SST('${time_idx}','${lat_idx}',31),(SST('${time_idx}','${lat_idx}',80)-SST('${time_idx}','${lat_idx}',31))/50,$west_east); SST('${time_idx}','${lat_idx}',31:80)=global@tmp(0:49);' $output_file $output_file done do...
Thank you for your time, Henry Unfortunately, I must say I had great trouble understanding your point. I did read thoroughly the User Guide - multiple times for the concerned section - and couldn't find relevant information for my problem. Nor did I found relevant thread on this forum, although I got some ideas to try. Please be assured I did spend time on that matter, wracking my brain... For now, I'm still asking myself : Can I use ncap2 and array() function on a limited range of longitudes ? And...
Thank you for your time, Henry Unfortunately, I must say I had great trouble understanding your point. I did read thoroughly the User Guide - multiple times for the concerned section - and couldn't find relevant information for my problem. Nor did I found relevant thread on this forum, although I got some ideas to try. Please be assured I did spend time on that matter, wracking my brain... For now, I'm still asking myself : Can I use ncap2 and array() function on a limited range of longitudes ? And...
Tries : ncap2 -O -s 'SST(1,60,:) = array(290.0f,0.1,$west_east)' test.nc output_test.nc This above is changing all the longitudes values from lat_idx = 60 with an array rightfully incremented. ncap2 -O -s 'SST(1,60,30:90) = array(290.0f,0.1,$west_east)' test.nc output_test.nc ncap2: ERROR assign(): Hyperslab for SST - number of elements on LHS(61) doesn't equal number of elements on RHS(120) Erreur de segmentation (core dumped) Of course this above does not work because the longitude range LHS is...