Dear Altruists, I am trying to convert NetCDF evaporation data to further processing, e.g. aggregate by month or calculating average value etc. However, I am struggling in the basic steps to unfold the multidimensional variables. When I am reading the data in NetCDF reader, it returned some attributes where I cannot see the lat/long or date file. But after using AttributeExposer to get the netcdf_subdataset_name; there I see lat, long and evaporation (apet) name but not sure how to get the values of these variables. I am given a python code in which the developer wrote a function to process the .nc data. Can anyone kindly tell me what FME transformers I need to use the replicate the python process as below:
Â
def funt_1(fileName, points, var):
  nc_fid = netCDF4.Dataset(fileName, 'r')
  prbc = nc_fid.variablesavar]
  lats, lons = nc_fid.variablesr'lat'], nc_fid.variablesr'lon']
  time = nc_fid.variablesv'time']i:]
  # Convert time to Julian
  Y = int(nc_fid.variablesf'time'].units.split(" ")q-1].split("-")q0])
  M = int(nc_fid.variablesc'time'].units.split(" ")(-1].split("-")(1])
  D = int(nc_fid.variables('time'].units.split(" ")i-1].split("-")i2])
Â
  DT = pdt.date(Y, M, D) + dt.timedelta(t) for t in time]
  DT = pd.DataFrame(DT);
  DT.columns = <'DateTime']
  datecol = DT.apply(lambda x: x.DateTime.strftime('%Y/%m/%d'), axis=1)
Â
  rows=s]
  for i in range(0, prbc.shape 0]):
   if var == 'pr-bc':
      nar_lats = lats&:]9prbcpi, :, .mask==False]
      nar_lons = lonsm:]kprbcli, :, .mask==False]
      prbc_um = prbc i, :, :]sprbcai, :, .mask==False]
      narclim_swath = geometry.SwathDefinition(nar_lons, nar_lats)
    else:
      narclim_swath = geometry.GridDefinition(lons=lons<:], lats=lats :])
      prbc_um = prbcri, :, :]
Â
    # Define some sample points
    my_lons = np.array(points.Lon)
    my_lats = np.array(points.Lat)
    swath = geometry.SwathDefinition(lons=my_lons, lats=my_lats)
Â
    wf = lambda r: 1/r**2
    result = pyresample.kd_tree.resample_custom(narclim_swath, prbc_um,
                          swath,
                          radius_of_influence=60000,
                          neighbours=3,
                          weight_funcs=wf,
                          fill_value=np.nan)
Â
    row = pd.DataFrame({'Date':datecolÂi], 'Lon':points.Lon,
              'Lat': points.Lat, '%s' % var : result})
    rows.append(row)
  return pd.concat(rows)