0

I am running the following script on a remote server.

awk '{sub(/.nc$/, ""); print}' Time012010star.txt > Star.txt #remove .nc
awk '{sub(/.nc$/, ".nc.gz"); print}' Time012010star.txt > StarGZ.txt # add .gz

TempsModel=$(wc -l < TempsModel.txt)  #"$(ls -lq *_??????.nc | wc -l)"
outputNumber=$(wc -l < Time012010star.txt)


UarrI1=$(sed -n $index'p' uI1.txt)
UarrI2=$(sed -n $index'p' uI2.txt)
UarrJ1=$(sed -n $index'p' uJ1.txt)
UarrJ2=$(sed -n $index'p' uJ2.txt)

VarrI1=$(sed -n $index'p' vI1.txt)
VarrI2=$(sed -n $index'p' vI2.txt)
VarrJ1=$(sed -n $index'p' vJ1.txt)
VarrJ2=$(sed -n $index'p' vJ2.txt)

TarrI1=$(sed -n $index'p' tI1.txt)
TarrI2=$(sed -n $index'p' tI2.txt)
TarrJ1=$(sed -n $index'p' tJ1.txt)
TarrJ2=$(sed -n $index'p' tJ2.txt)

# from all the netcdf files extract the vel_u (and eventually vel_v) with the indices that are in *I1.txt and *J1.txt
for ((index=1; index<=$outputNumber; index++)) #size de I.txt 
do


TimeNC=$(sed -n $index'p' Time012010star.txt) #TempsModel.txt
Time=$(sed -n $index'p' Star.txt)
TimeGZ=$(sed -n $index'p' StarGZ.txt)

scp -r /home/elisev/QUANTUM/Jan2010/${TimeGZ}  /home/elisev/ScriptsLinux/SOLA/Scripts/${TimeGZ} #copy remote file locally
gunzip /home/elisev/ScriptsLinux/SOLA/Scripts/${TimeGZ}

    ncrcat -C -F -d nj_u,$UarrJ1,$UarrJ2 -d ni_u,$UarrI1,$UarrI2 -v vel_u /${TimeNC} u${Time}.nc 
    ncrcat -C -F -d nj_v,$VarrJ1,$VarrJ2 -d ni_v,$VarrI1,$VarrI2 -v vel_v /${TimeNC} v${Time}.nc
    ncrcat -C -F -d nj_w,$TarrJ1,$TarrJ2 -d ni_w,$TarrI1,$TarrI2 -v w /${TimeNC} w${Time}.nc
    ncrcat -C -F -d nj_t,$TarrJ1,$TarrJ2 -d ni_t,$TarrI1,$TarrI2 -v sal /${TimeNC} sal${Time}.nc
    ncrcat -C -F -d nj_t,$TarrJ1,$TarrJ2 -d ni_t,$TarrI1,$TarrI2 -v tem /${TimeNC} tem${Time}.nc

    echo "${Time}"
rm  /home/elisev/ScriptsLinux/SOLA/Scripts/${TimeNC} 
done
echo "Loop is done"

It copy's the first file correctly, but then it gives me the following error

ncrcat: WARNING not searching for /20100101_0020*.nc on remote filesystem, using local file 0100101_0020*.nc instead
ncrcat: WARNING not searching for /20100101_0020*.nc on remote filesystem, using local file 0100101_0020*.nc instead
ncrcat: WARNING not searching for /20100101_0020*.nc on remote filesystem, using local file 0100101_0020*.nc instead
ncrcat: WARNING not searching for /20100101_0020*.nc on remote filesystem, using local file 0100101_0020*.nc instead
ncrcat: WARNING not searching for /20100101_0020*.nc on remote filesystem, using local file 0100101_0020*.nc instead

It does create files, but I don't know what of, since I do not seem to have any files named 0100101_0020*.nc. How do I resolve this?

1 Answer 1

0

I found the solution. Apparently, even if you run the script in the same directory as all the folders are in, you need to explicitly tell it the path to the folders, so these lines

ncrcat -C -F -d nj_u,$UarrJ1,$UarrJ2 -d ni_u,$UarrI1,$UarrI2 -v vel_u /${TimeNC} u${Time}.nc

need to become

crcat -C -F -d nj_u,$UarrJ1,$UarrJ2 -d ni_u,$UarrI1,$UarrI2 -v vel_u path/to/file/${TimeNC} u${Time}.nc

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .