I am new to R and have to calculate area weighted seasonal (Kharif= day 151-304 and Rabi= 305-90) cumulative precipitation over indus basin. Mean where there is some crop fraction (ranges from 0-1.57 for different crop types) area value is true either in full or a part of a cell, then precipitation only for that particular part of the grid will be used as mask to calculate cumulative precipitation
I have crop fractional area (cropfrac) file (.nc and .bin formats) with 30 time steps (1 value per year) with 32 layers for 32 crop types. I have daily precipitation data from 1981-2010 in ncdf 4 format. I have ascii files for areas (i.e. Indus, Ganges river basins).
To my understanding, first I have to read cropfrac file at all time steps and at all grid points (lat, lon) using loop and if there is some cropfractional area exist then I have to call precipitation data again for all time steps and al grid points, multiply it with cropfraction and grid size, sum precipitation over all time steps in a grid and finally divide by total crop and grid area. But how to make a connection in all these steps is missing.
Can anybody help or suggest me.
Thanking in advance and looking forward to receiving quick help and suggestions, please
direct contact ID: email@example.com