Dear Mara,
Thanks for your kind email and nice suggestion to get help from reprex
I have installed reprex and now on the clipboard.
I tried to make code with split parts i.e. to read cftfrac file, read
precipitation file but still not sure how to run loop first to identify
grids step by step and where there is some cropfractional area exist then
call precipitation data and to write as output.nc
My specific task is: first I have to read ascii file for a specific basin
say basin name= Indus and basinnrs= 1.
Then I have to read cropfractional area file (which contains
croppefractional area in some grids and is different for different crop
types) which contains 30 time steps for all grid points for 32 crop types.
nyearcft <- 30
Ncellcft <- lat*lon
nbandscft <- 32
for (year in 1:nyear)
{
print(year)
for (i in 1:ncell)
{
for (k in 1:nbands)
then I have to apply some if statement i.e.
if(cropfractional area = true, read prec and write)
My precipitation file is a daily data in .nc format with 65975 gridcells.
nyearspre <- 30 (1981-2010)
ncells <- xval*yval
how to make a link between years/gridcells (i,j)/32 layers with
precipitation in each grid at all timesteps. after precipitation only for
cropfractional area grids, I want to cumulate for seasons
my code is attached herewith for your kind reference please,
kind reply or guidance is appreciated in advance
Thanks and best regards