Thank you Charlie for your prompt response!
Hi, I have a number of netcdf files which have uneven number of time steps for the variables included in the files. I am using a loop to read all files and I would like to select and extract a specific variable only at the last time step from each file. Is there a way to do this ?
Thank you Charlie.
I mean that if I run the same code without the renaming operators, I don't get any errors.
Hi Henry, Sorry. I posted a simplified version of my code. I am looping because I want to extract the same variables from multiple files and append them again. Here is my original code: str="_06:00:00" for d in {11..27} do infile=wrfout_bingo_d03_1994-11- infile=$infile$(printf "%02d" $d) infile=$infile$str day1='06:00:00 1994-11-' day1=$day1$d step=0 stepf=23 # 24 hourly steps from 0 to 23 if [[ $d -eq 27 ]] ; then stepf=0; fi min=0 for step in $(seq 0 $stepf) do filename=$(date -d "$day1 + $min...
Hi Henry, Sorry. I posted a simplified version of my code. I am looping because I want to extract the same variables from multiple files and append them again. Here is my original code: str="_06:00:00" for d in {11..27} do infile=wrfout_bingo_d03_1994-11- infile=$infile$(printf "%02d" $d) infile=$infile$str day1='06:00:00 1994-11-' day1=$day1$d step=0 stepf=23 # 24 hourly steps from 0 to 23 if [[ $d -eq 27 ]] ; then stepf=0; fi min=0 for step in $(seq 0 $stepf) do filename=$(date -d "$day1 + $min...
Hi Henry , I loop through the timesteps of File1, I extract variables SNOW and SNOWH, I rename them and then append them in File2.nc stepf=23 for step in $(seq 0 $stepf) do ncks -A -d Time,$step -v SNOW,SNOWH File1.nc filex.nc ncrename -v SNOW,WEASD filex.nc ncrename -v SNOWH,SNODEP filex.nc ncks --abc -A -v WEASD,SNODEP filex.nc File2.nc done Yianis
Hi Henry , I loop through the timesteps of File1, I extract variables SNOW and SNOWH, I rename them and then append them in File2.nc stepf=23 for step in $(seq 0 $stepf) do ncks -A -d Time,$step -v SNOW,SNOWH File1.nc .filex.nc ncrename -v SNOW,WEASD filex.nc ncrename -v SNOWH,SNODEP filex.nc ncks --abc -A -v WEASD,SNODEP filex.nc File2.nc done Yianis