Writing data to shapefile's attribute table from NetCDF

I have a shapefile (lines) and netcdf file both linked with netid. The netcdf has two dimensions (time and netid) one variable (Qout). The netcdf file has a time series of about 40 years and need to compute a trend and export the data into the shapefile for plotting in ggplot using the values in the attribute table (using something ggplot(shp) + geom_sf(aes(colour = shp$Duration))).

  dimensions:
         time = UNLIMITED ; // (12784 currently)
         netid = 716862 ;

variables:
     float Qout(time, netid) 

The trend is based on the Mann-Kendall test.

  Rs=ts(s,start=1979)
  mk.test(Rs)
  sens.slope(Rs)

Please let me know if you have any idea how to create a loop reading the Qout for each netid and wrtite the mk.test and sens.slope to the shapefile based its netid.

Best regards,

Solomon

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.