title: How can I convert 3d variable in array with regridded another 1d variable(which is in same array) from netCDF4?
body: <p>I'm trying to handle netCDF4 file and it has dimensions and variables like this.</p>
  <pre><code>&lt;xarray.DataArray '/' ()&gt;
  array(&lt;class 'netCDF4._netCDF4.Dataset'&gt;
  root group (NETCDF3_CLASSIC data model, file format NETCDF3):
      Title: Monthly version of HadISST sea surface temperature component
      description: HadISST 1.1 monthly average sea surface temperature
      institution: Met Office Hadley Centre
      source: HadISST
      reference: Rayner, N. A., Parker, D. E., Horton, E. B., Folland, C. K., Alexander, L. V., Rowell, D. P., Kent, E. C., Kaplan, A.  Global analyses of sea surface temperature, sea ice, and night marine air temperature since the late nineteenth century J. Geophys. Res.Vol. 108, No. D14, 4407 10.1029/2002JD002670
      Conventions: CF-1.0
      history: 8/12/2021 converted to netcdf from pp format
      supplementary_information: Updates and supplementary information will be available from http://www.metoffice.gov.uk/hadobs/hadisst
      comment: Data restrictions: for academic research use only. Data are Crown copyright see (http://www.opsi.gov.uk/advice/crown-copyright/copyright-guidance/index.htm)
      dimensions(sizes): time(1822), latitude(180), longitude(360), nv(2)
      variables(dimensions): float32 time(time), float32 time_bnds(time, nv), float32 latitude(latitude), float32 longitude(longitude), float32 sst(time, latitude, longitude)
      groups: , dtype=object)
  </code></pre>
  <p>Here, I wanted to regrid the longitude grid from (-180, 180) to (0, 360), so I did it using numpy.</p>
  <p>And the problem is,</p>
  <pre><code>In [10]: print(DATA1['sst'])
  &lt;class 'netCDF4._netCDF4.Variable'&gt;
  float32 sst(time, latitude, longitude)
      _FillValue: -1e+30
      standard_name: sea_surface_temperature
      long_name: sst
      units: C
      cell_methods: time: lat: lon: mean
      missing_value: -1e+30
  unlimited dimensions: time
  current shape = (1822, 180, 360)
  filling on
  </code></pre>
  <p>that changed longitude affects sst, which is another variable. So I have to do something to SST too, as I've done to longitude. But I do not know what I have to do...
  (I'd like to make this with only numpy as long as possible!)</p>
  <p>Here, it's what I've made so far</p>
  <pre><code>from netCDF4 import Dataset
  import cartopy.crs as ccrs
  from sys import exit    
  import numpy as np
  import pickle
  
  file1= 'HadISST_sst.nc'
  DATA1 = Dataset(file1, 'r')
  hd_lat = DATA1.variables['latitude'][:] 
  hd_lon0 = DATA1.variables['longitude'][:] 
  hd_sst0 = DATA1.variables['sst'][1320:,:,:]
  DATA1.close()
  
  #Regridding longitude
  id = np.where(hd_lon0 == 0)[0]  # &lt;-- id = 180
  a = hd_lon0[:180] + 360
  b = hd_lon0[180:]
  hd_lon = np.zeros_like[hd_lon0]
  hd_lon[:180] = b
  hd_lon[180:] = a
  </code></pre>