Extract a value from a curvilinear grid¶
A small notebook showing how to lookup the ij index from a given longitude and latitude in a curvilinear grid
import xarray as xr
import numpy as np
ds = xr.open_dataset('./Data/C10M-PNG-560/OCE/Analyse/SE/C10M-PNG-560_SE_4655_4704_1M_grid_T.nc')
ds
<xarray.Dataset> Dimensions: (axis_nbounds: 2, deptht: 31, tbnds: 2, time_counter: 12, x: 182, y: 149) Coordinates: * time_counter (time_counter) object 0000-01-16 00:00:00 ... 0000-... nav_lat (y, x) float32 -78.19 -78.19 -78.19 ... 59.91 59.91 nav_lon (y, x) float32 105.0 107.0 109.0 ... 106.0 106.0 106.0 * deptht (deptht) float32 5.0 15.0 25.0 ... 4.75e+03 5.25e+03 time_centered (time_counter) object 4679-07-16 00:00:00 ... 4680-... Dimensions without coordinates: axis_nbounds, tbnds, x, y Data variables: (12/64) time_counter_bnds (time_counter, tbnds) object 0000-01-01 00:00:00 ..... deptht_bounds (deptht, axis_nbounds) float32 0.0 10.0 ... 5.501e+03 time_centered_bounds (time_counter, axis_nbounds) object 4679-07-01 00:0... time_counter_bounds (time_counter, axis_nbounds) float64 8.645e+10 ... ... e3t (time_counter, deptht, y, x) float32 ... pbo (time_counter, y, x) float32 ... ... ... rain (time_counter, y, x) float32 ... snow_ao_cea (time_counter, y, x) float32 ... snow_ai_cea (time_counter, y, x) float32 ... evap_ao_cea (time_counter, y, x) float32 ... subl_ai_cea (time_counter, y, x) float32 ... sosflxdo (time_counter, y, x) float32 ... Attributes: name: C10M-PNG-560_1m_grid_T description: Created by xios title: Created by xios Conventions: CF-1.6 timeStamp: 2019-Dec-10 12:48:46 GMT uuid: 0b59c577-6754-47de-a26a-a13d8a514539 LongName: IPSL 10 Ma,2X, BC from PlioMIP except for Aust... history: Wed Dec 11 05:53:06 2019: ncrcat -C --buffer_s... NCO: "4.6.0" nco_openmp_thread_number: 1
xarray.Dataset
- axis_nbounds: 2
- deptht: 31
- tbnds: 2
- time_counter: 12
- x: 182
- y: 149
- time_counter(time_counter)object0000-01-16 00:00:00 ... 0000-12-...
- bounds :
- time_counter_bnds
- time_origin :
- 01-JAN-0000 00:00:00
array([cftime.Datetime360Day(0, 1, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 2, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 3, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 4, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 5, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 6, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 7, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 8, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 9, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 10, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 11, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 12, 16, 0, 0, 0, 0, has_year_zero=False)], dtype=object)
- nav_lat(y, x)float32...
- standard_name :
- latitude
- long_name :
- Latitude
- units :
- degrees_north
array([[-78.19058 , -78.19058 , -78.19058 , ..., -78.19058 , -78.19058 , -78.19058 ], [-77.7742 , -77.7742 , -77.7742 , ..., -77.7742 , -77.7742 , -77.7742 ], [-77.34337 , -77.34337 , -77.34337 , ..., -77.34337 , -77.34337 , -77.34337 ], ..., [ 59.725872, 59.725872, 59.73183 , ..., 59.73183 , 59.725872, 59.725872], [ 59.910233, 59.910233, 59.910248, ..., 59.910248, 59.910233, 59.910233], [ 59.910233, 59.910233, 59.910248, ..., 59.910248, 59.910233, 59.910233]], dtype=float32)
- nav_lon(y, x)float32...
- standard_name :
- longitude
- long_name :
- Longitude
- units :
- degrees_east
array([[105. , 107. , 109. , ..., 103. , 105. , 107. ], [105. , 107. , 109. , ..., 103. , 105. , 107. ], [105. , 107. , 109. , ..., 103. , 105. , 107. ], ..., [105.98919 , 106.01081 , 106.054634, ..., 105.945366, 105.98919 , 106.01081 ], [105.999725, 106.000275, 106.00089 , ..., 105.99911 , 105.999725, 106.000275], [106. , 105.999725, 105.99911 , ..., 106.00089 , 106. , 105.999725]], dtype=float32)
- deptht(deptht)float325.0 15.0 25.0 ... 4.75e+03 5.25e+03
- name :
- deptht
- long_name :
- Vertical T levels
- units :
- m
- positive :
- down
- bounds :
- deptht_bounds
array([4.999938e+00, 1.500029e+01, 2.500176e+01, 3.500541e+01, 4.501332e+01, 5.502950e+01, 6.506181e+01, 7.512551e+01, 8.525037e+01, 9.549429e+01, 1.059699e+02, 1.168962e+02, 1.286979e+02, 1.421953e+02, 1.589606e+02, 1.819628e+02, 2.166479e+02, 2.724767e+02, 3.643030e+02, 5.115348e+02, 7.322009e+02, 1.033217e+03, 1.405698e+03, 1.830885e+03, 2.289768e+03, 2.768242e+03, 3.257479e+03, 3.752442e+03, 4.250401e+03, 4.749913e+03, 5.250227e+03], dtype=float32)
- time_centered(time_counter)object...
- standard_name :
- time
- long_name :
- Time axis
- time_origin :
- 1900-01-01 00:00:00
- bounds :
- time_centered_bounds
- cell_methods :
- time_counter: mean
array([cftime.Datetime360Day(4679, 7, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 8, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 9, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 10, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 11, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 12, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 1, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 2, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 3, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 4, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 5, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 6, 16, 0, 0, 0, 0, has_year_zero=False)], dtype=object)
- time_counter_bnds(time_counter, tbnds)object...
array([[cftime.Datetime360Day(0, 1, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 2, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(0, 2, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 3, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(0, 3, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 4, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(0, 4, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 5, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(0, 5, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 6, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(0, 6, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 7, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(0, 7, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 8, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(0, 8, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 9, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(0, 9, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 10, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(0, 10, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 11, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(0, 11, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 12, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(0, 12, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(1, 1, 1, 0, 0, 0, 0, has_year_zero=False)]], dtype=object)
- deptht_bounds(deptht, axis_nbounds)float32...
- units :
- m
array([[ 0. , 10.000015], [ 10.000015, 20.000834], [ 20.000834, 30.003216], [ 30.003216, 40.008644], [ 40.008644, 50.020004], [ 50.020004, 60.042915], [ 60.042915, 70.08833 ], [ 70.08833 , 80.17757 ], [ 80.17757 , 90.35213 ], [ 90.35213 , 100.692795], [ 100.692795, 111.35667 ], [ 111.35667 , 122.64877 ], [ 122.64877 , 135.15974 ], [ 135.15974 , 150.02681 ], [ 150.02681 , 169.41597 ], [ 169.41597 , 197.36778 ], [ 197.36778 , 241.12593 ], [ 241.12593 , 312.74466 ], [ 312.74466 , 429.72336 ], [ 429.72336 , 611.8891 ], [ 611.8891 , 872.8738 ], [ 872.8738 , 1211.588 ], [1211.588 , 1612.9757 ], [1612.9757 , 2057.1313 ], [2057.1313 , 2527.2168 ], [2527.2168 , 3011.8994 ], [3011.8994 , 3504.455 ], [3504.455 , 4001.159 ], [4001.159 , 4500.0215 ], [4500.0215 , 5000. ], [5000. , 5500.5645 ]], dtype=float32)
- time_centered_bounds(time_counter, axis_nbounds)object...
- cell_methods :
- time_counter: mean
array([[cftime.Datetime360Day(4679, 7, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 8, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(4679, 8, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 9, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(4679, 9, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 10, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(4679, 10, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 11, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(4679, 11, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 12, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(4679, 12, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 1, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(4680, 1, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 2, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(4680, 2, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 3, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(4680, 3, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 4, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(4680, 4, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 5, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(4680, 5, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 6, 1, 0, 0, 0, 0, has_year_zero=False)], [cftime.Datetime360Day(4680, 6, 1, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 7, 1, 0, 0, 0, 0, has_year_zero=False)]], dtype=object)
- time_counter_bounds(time_counter, axis_nbounds)float64...
- cell_methods :
- time_counter: mean
array([[8.645357e+10, 8.645616e+10], [8.645616e+10, 8.645875e+10], [8.645875e+10, 8.646134e+10], [8.646134e+10, 8.646394e+10], [8.646394e+10, 8.646653e+10], [8.646653e+10, 8.646912e+10], [8.646912e+10, 8.647171e+10], [8.647171e+10, 8.647430e+10], [8.647430e+10, 8.647690e+10], [8.647690e+10, 8.647949e+10], [8.647949e+10, 8.648208e+10], [8.648208e+10, 8.648467e+10]])
- e3t(time_counter, deptht, y, x)float32...
- standard_name :
- cell_thickness
- long_name :
- T-cell thickness
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[10087896 values with dtype=float32]
- pbo(time_counter, y, x)float32...
- standard_name :
- sea_water_pressure_at_sea_floor
- long_name :
- Pressure_at_sea_floor
- units :
- dbar
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- zos(time_counter, y, x)float32...
- standard_name :
- sea_surface_height_above_geoid
- long_name :
- sea_surface_height_above_geoid
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- zossq(time_counter, y, x)float32...
- standard_name :
- square_of_sea_surface_height_above_geoid
- long_name :
- square_of_sea_surface_height_above_geoid
- units :
- m2
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- thetao(time_counter, deptht, y, x)float32...
- standard_name :
- sea_water_potential_temperature
- long_name :
- sea_water_potential_temperature
- units :
- degC
- online_operation :
- average
- interval_operation :
- 1 month
- interval_write :
- 1 month
- cell_methods :
- time: mean time_counter: mean
[10087896 values with dtype=float32]
- tos(time_counter, y, x)float32...
- standard_name :
- sea_surface_temperature
- long_name :
- sea_surface_temperature
- units :
- degC
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- tossq(time_counter, y, x)float32...
- standard_name :
- square_of_sea_surface_temperature
- long_name :
- square_of_sea_surface_temperature
- units :
- degC2
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- so(time_counter, deptht, y, x)float32...
- standard_name :
- sea_water_practical_salinity
- long_name :
- sea_water_salinity
- units :
- 1e-3
- online_operation :
- average
- interval_operation :
- 1 month
- interval_write :
- 1 month
- cell_methods :
- time: mean time_counter: mean
[10087896 values with dtype=float32]
- sos(time_counter, y, x)float32...
- standard_name :
- sea_surface_salinity
- long_name :
- sea_surface_salinity
- units :
- 1e-3
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- rhopoto(time_counter, deptht, y, x)float32...
- standard_name :
- sea_water_sigma_theta
- long_name :
- sea_water_potential_density
- units :
- kg/m3
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[10087896 values with dtype=float32]
- omlmax(time_counter, y, x)float32...
- standard_name :
- ocean_mixed_layer_thickness_defined_by_vertical_tracer_diffusivity
- long_name :
- ocean_mixed_layer_thickness_defined_by_mixing_scheme
- units :
- m
- online_operation :
- maximum
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: maximum (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- mldkz5(time_counter, y, x)float32...
- standard_name :
- ocean_mixed_layer_thickness_defined_by_vertical_tracer_diffusivity
- long_name :
- Turbocline depth (Kz = 5e-4)
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- mldr10_1(time_counter, y, x)float32...
- standard_name :
- ocean_mixed_layer_thickness_defined_by_sigma_theta
- long_name :
- Mixed Layer Depth (dsigma = 0.01 wrt 10m)
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- mldr10_1max(time_counter, y, x)float32...
- standard_name :
- ocean_mixed_layer_thickness_defined_by_sigma_theta
- long_name :
- max of Mixed Layer Depth 0.01 ref.10m
- units :
- m
- online_operation :
- maximum
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: maximum (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- wfcorr(time_counter, y, x)float32...
- standard_name :
- water_flux_out_of_sea_water_due_to_newtonian_relaxation
- long_name :
- water_flux_correction
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- nshfls(time_counter, y, x)float32...
- long_name :
- surface_net_downward_non_solar_flux
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- rsntds(time_counter, y, x)float32...
- standard_name :
- net_downward_shortwave_flux_at_sea_water_surface
- long_name :
- surface_net_downward_shortwave_flux
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- rsds(time_counter, deptht, y, x)float32...
- standard_name :
- downwelling_shortwave_flux_in_sea_water
- long_name :
- downwelling_shortwave_flux_in_sea_water
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[10087896 values with dtype=float32]
- hfcorr(time_counter, y, x)float32...
- standard_name :
- heat_flux_into_sea_water_due_to_newtonian_relaxation
- long_name :
- heat_flux_correction
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- mlddzt(time_counter, y, x)float32...
- standard_name :
- depth_at_maximum_upward_derivative_of_sea_water_potential_temperature
- long_name :
- Thermocline Depth (depth of max dT/dz)
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- mldr10_3(time_counter, y, x)float32...
- standard_name :
- ocean_mixed_layer_thickness_defined_by_sigma_theta
- long_name :
- Mixed Layer Depth (dsigma = 0.03 wrt 10m)
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- mldr0_1(time_counter, y, x)float32...
- standard_name :
- ocean_mixed_layer_thickness_defined_by_sigma_theta
- long_name :
- Mixed Layer Depth (dsigma = 0.01 wrt sfc)
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- mldr0_3(time_counter, y, x)float32...
- standard_name :
- ocean_mixed_layer_thickness_defined_by_sigma_theta
- long_name :
- Mixed Layer Depth (dsigma = 0.03 wrt sfc)
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- mld_dt02(time_counter, y, x)float32...
- standard_name :
- ocean_mixed_layer_thickness_defined_by_temperature
- long_name :
- Mixed Layer Depth (|dT| = 0.2 wrt 10m)
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- topthdep(time_counter, y, x)float32...
- standard_name :
- ocean_mixed_layer_thickness_defined_by_temperature
- long_name :
- Top of Thermocline Depth (dT = -0.2 wrt 10m)
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- pycndep(time_counter, y, x)float32...
- standard_name :
- ocean_mixed_layer_thickness_defined_by_sigma_theta
- long_name :
- Pycnocline Depth (dsigma[dT=-0.2] wrt 10m)
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- BLT(time_counter, y, x)float32...
- long_name :
- Barrier Layer Thickness
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- tinv(time_counter, y, x)float32...
- long_name :
- Max of vertical invertion of temperature
- units :
- degC
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- depti(time_counter, y, x)float32...
- long_name :
- Depth of max. vert. inv. of temperature
- units :
- m
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- hc300(time_counter, y, x)float32...
- standard_name :
- integral_of_sea_water_potential_temperature_wrt_depth_expressed_as_heat_content
- long_name :
- Heat content 0-300m
- units :
- J/m2
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
[325416 values with dtype=float32]
- hdivtr(time_counter, deptht, y, x)float32...
- long_name :
- horizontal divergence transport
- units :
- s-1
- online_operation :
- average
- interval_operation :
- 1 month
- interval_write :
- 1 month
- cell_methods :
- time: mean time_counter: mean
[10087896 values with dtype=float32]
- windsp(time_counter, y, x)float32...
- standard_name :
- wind_speed
- long_name :
- wind speed module
- units :
- m/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- wfob(time_counter, y, x)float32...
- standard_name :
- water_flux_out_of_sea_ice_and_sea_water
- long_name :
- water_flux_into_sea_water at prev time-step
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- fmmflx(time_counter, y, x)float32...
- long_name :
- Water flux due to freezing/melting
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- siconc(time_counter, y, x)float32...
- standard_name :
- sea_ice_area_fraction
- long_name :
- ice concentration
- units :
- %
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- sicover(time_counter, y, x)float32...
- standard_name :
- sea_ice_area_fraction
- long_name :
- seaice cover
- units :
- 1
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- qt(time_counter, y, x)float32...
- standard_name :
- surface_downward_heat_flux_in_sea_water
- long_name :
- net downward total flux at ocean surface
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- qtoce(time_counter, y, x)float32...
- standard_name :
- surface_downward_heat_flux_in_sea_water
- long_name :
- downward total flux at ocean surface
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- qemp_oce(time_counter, y, x)float32...
- long_name :
- Downward Heat Flux from E-P over open ocean
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- qt_ice(time_counter, y, x)float32...
- standard_name :
- surface_downward_heat_flux_in_air
- long_name :
- downward total flux at ice surface
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- qemp_ice(time_counter, y, x)float32...
- long_name :
- Downward Heat Flux from E-P over ice
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- hflx_rain_cea(time_counter, y, x)float32...
- standard_name :
- temperature_flux_due_to_rainfall_expressed_as_heat_flux_into_sea_water
- long_name :
- heat flux due to rainfall
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- hflx_evap_cea(time_counter, y, x)float32...
- standard_name :
- temperature_flux_due_to_evaporation_expressed_as_heat_flux_out_of_sea_water
- long_name :
- heat flux due to evaporation
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- hflx_snow_cea(time_counter, y, x)float32...
- standard_name :
- heat_flux_into_sea_water_due_to_snow_thermodynamics
- long_name :
- heat flux due to snow falling over ice-free ocean
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- hflx_cal_cea(time_counter, y, x)float32...
- standard_name :
- heat_flux_into_sea_water_due_to_iceberg_thermodynamics
- long_name :
- heat flux due to calving
- units :
- W/m2
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- wfo(time_counter, y, x)float32...
- standard_name :
- water_flux_out_of_sea_ice_and_sea_water
- long_name :
- water_flux_into_sea_water
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- emp_oce(time_counter, y, x)float32...
- standard_name :
- evap_minus_precip_over_sea_water
- long_name :
- Evap minus Precip over ocean
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- emp_ice(time_counter, y, x)float32...
- standard_name :
- evap_minus_precip_over_sea_ice
- long_name :
- Evap minus Precip over ice
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- friver(time_counter, y, x)float32...
- standard_name :
- water_flux_into_sea_water_from_rivers
- long_name :
- water_flux_into_sea_water_from_rivers
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- calving(time_counter, y, x)float32...
- standard_name :
- water_flux_into_sea_water_from_icebergs
- long_name :
- Calving
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- vfxice(time_counter, y, x)float32...
- long_name :
- ice melt/growth
- units :
- m/day
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- vfxsnw(time_counter, y, x)float32...
- long_name :
- snw melt/growth
- units :
- m/day
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- vfxsub(time_counter, y, x)float32...
- long_name :
- snw sublimation
- units :
- m/day
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- vfxspr(time_counter, y, x)float32...
- long_name :
- snw precipitation on ice
- units :
- m/day
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- rain(time_counter, y, x)float32...
- standard_name :
- rainfall_flux
- long_name :
- Liquid precipitation
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- snow_ao_cea(time_counter, y, x)float32...
- standard_name :
- snowfall_flux
- long_name :
- Snow over ice-free ocean (cell average)
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- snow_ai_cea(time_counter, y, x)float32...
- standard_name :
- snowfall_flux
- long_name :
- Snow over sea-ice (cell average)
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- evap_ao_cea(time_counter, y, x)float32...
- standard_name :
- water_evaporation_flux
- long_name :
- Evaporation over ice-free ocean (cell average)
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- subl_ai_cea(time_counter, y, x)float32...
- standard_name :
- surface_snow_and_ice_sublimation_flux
- long_name :
- Sublimation over sea-ice (cell average)
- units :
- kg/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- sosflxdo(time_counter, y, x)float32...
- long_name :
- Downward salt flux
- units :
- 1e-3/m2/s
- online_operation :
- average
- interval_operation :
- 24000 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 24000 s) time_counter: mean
[325416 values with dtype=float32]
- name :
- C10M-PNG-560_1m_grid_T
- description :
- Created by xios
- title :
- Created by xios
- Conventions :
- CF-1.6
- timeStamp :
- 2019-Dec-10 12:48:46 GMT
- uuid :
- 0b59c577-6754-47de-a26a-a13d8a514539
- LongName :
- IPSL 10 Ma,2X, BC from PlioMIP except for Australia position with only 1 PNG
- history :
- Wed Dec 11 05:53:06 2019: ncrcat -C --buffer_size 838860800 -O -v BLT,calving,deptht,deptht_bounds,depti,e3t,emp_ice,emp_oce,evap_ao_cea,fmmflx,friver,hc300,hdivtr,hfcorr,hflx_cal_cea,hflx_evap_cea,hflx_rain_cea,hflx_snow_cea,mld_dt02,mlddzt,mldkz5,mldr0_1,mldr0_3,mldr10_1,mldr10_1max,mldr10_3,nav_lat,nav_lon,nshfls,omlmax,pbo,pycndep,qemp_ice,qemp_oce,qt,qt_ice,qtoce,rain,rhopoto,rsds,rsntds,siconc,sicover,snow_ai_cea,snow_ao_cea,so,sos,sosflxdo,subl_ai_cea,thetao,time_centered,time_centered_bounds,time_counter,time_counter_bounds,tinv,topthdep,tos,tossq,vfxice,vfxsnw,vfxspr,vfxsub,wfcorr,wfo,wfob,windsp,zos,zossq C10M-PNG-560_SE01_4655_4704_1M_grid_T.nc C10M-PNG-560_SE02_4655_4704_1M_grid_T.nc C10M-PNG-560_SE03_4655_4704_1M_grid_T.nc C10M-PNG-560_SE04_4655_4704_1M_grid_T.nc C10M-PNG-560_SE05_4655_4704_1M_grid_T.nc C10M-PNG-560_SE06_4655_4704_1M_grid_T.nc C10M-PNG-560_SE07_4655_4704_1M_grid_T.nc C10M-PNG-560_SE08_4655_4704_1M_grid_T.nc C10M-PNG-560_SE09_4655_4704_1M_grid_T.nc C10M-PNG-560_SE10_4655_4704_1M_grid_T.nc C10M-PNG-560_SE11_4655_4704_1M_grid_T.nc C10M-PNG-560_SE12_4655_4704_1M_grid_T.nc C10M-PNG-560_SE_4655_4704_1M_grid_T.nc Wed Dec 11 05:49:20 2019: ncra -C --buffer_size 838860800 -O -v BLT,calving,deptht,deptht_bounds,depti,e3t,emp_ice,emp_oce,evap_ao_cea,fmmflx,friver,hc300,hdivtr,hfcorr,hflx_cal_cea,hflx_evap_cea,hflx_rain_cea,hflx_snow_cea,mld_dt02,mlddzt,mldkz5,mldr0_1,mldr0_3,mldr10_1,mldr10_1max,mldr10_3,nav_lat,nav_lon,nshfls,omlmax,pbo,pycndep,qemp_ice,qemp_oce,qt,qt_ice,qtoce,rain,rhopoto,rsds,rsntds,siconc,sicover,snow_ai_cea,snow_ao_cea,so,sos,sosflxdo,subl_ai_cea,thetao,time_centered,time_centered_bounds,time_counter,time_counter_bounds,tinv,topthdep,tos,tossq,vfxice,vfxsnw,vfxspr,vfxsub,wfcorr,wfo,wfob,windsp,zos,zossq -d time_counter,0,,12 C10M-PNG-560_46550101_46641230_1M_grid_T.nc C10M-PNG-560_46650101_46741230_1M_grid_T.nc C10M-PNG-560_46750101_46841230_1M_grid_T.nc C10M-PNG-560_46850101_46941230_1M_grid_T.nc C10M-PNG-560_46950101_47041230_1M_grid_T.nc C10M-PNG-560_SE01_4655_4704_1M_grid_T.nc Tue Dec 10 16:54:52 2019: ncrcat -C --buffer_size 838860800 -p /ccc/scratch/cont003/gen2212/sarrantc/IGCM_OUT/IPSLCM5A2/PROD/paleo/C10M-PNG-560/OCE/Output/MO C10M-PNG-560_46550101_46551230_1M_grid_T.nc C10M-PNG-560_46560101_46561230_1M_grid_T.nc C10M-PNG-560_46570101_46571230_1M_grid_T.nc C10M-PNG-560_46580101_46581230_1M_grid_T.nc C10M-PNG-560_46590101_46591230_1M_grid_T.nc C10M-PNG-560_46600101_46601230_1M_grid_T.nc C10M-PNG-560_46610101_46611230_1M_grid_T.nc C10M-PNG-560_46620101_46621230_1M_grid_T.nc C10M-PNG-560_46630101_46631230_1M_grid_T.nc C10M-PNG-560_46640101_46641230_1M_grid_T.nc --output C10M-PNG-560_46550101_46641230_1M_grid_T.nc
- NCO :
- "4.6.0"
- nco_openmp_thread_number :
- 1
Small function to find the closest ij coordinates in the curvilinear longitudes and latitudes and returns the ij coordinates.
It would be good to be able to do this with multiple longitude and latitude values but the np.substract doesn't seem to be working correctly.
def find_nearest(lons, lats, lon0,lat0):
idx = ((lons - lon0)**2+(lats - lat0)**2).argmin()
return np.unravel_index(idx, lons.shape)
Get the ij coordinates
lon = 12
lat = 10
find_nearest(ds.nav_lon.values, ds.nav_lat.values, lon, lat)
(90, 133)
The find_nearest
returns the indexs of the closest point so we use them with isel
to get the value of the given variable (here tos)
y, x = find_nearest(ds.nav_lon.values, ds.nav_lat.values, lon, lat)
ds['tos'].isel(x=x, y=y)
<xarray.DataArray 'tos' (time_counter: 12)> array([nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan], dtype=float32) Coordinates: * time_counter (time_counter) object 0000-01-16 00:00:00 ... 0000-12-16 0... nav_lat float32 10.51 nav_lon float32 11.0 time_centered (time_counter) object 4679-07-16 00:00:00 ... 4680-06-16 0... Attributes: standard_name: sea_surface_temperature long_name: sea_surface_temperature units: degC online_operation: average interval_operation: 4800 s interval_write: 1 month cell_methods: time: mean (interval: 4800 s) time_counter: mean
xarray.DataArray
'tos'
- time_counter: 12
- nan nan nan nan nan nan nan nan nan nan nan nan
array([nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan], dtype=float32)
- time_counter(time_counter)object0000-01-16 00:00:00 ... 0000-12-...
- bounds :
- time_counter_bnds
- time_origin :
- 01-JAN-0000 00:00:00
array([cftime.Datetime360Day(0, 1, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 2, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 3, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 4, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 5, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 6, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 7, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 8, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 9, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 10, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 11, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(0, 12, 16, 0, 0, 0, 0, has_year_zero=False)], dtype=object)
- nav_lat()float3210.51
- standard_name :
- latitude
- long_name :
- Latitude
- units :
- degrees_north
array(10.509401, dtype=float32)
- nav_lon()float3211.0
- standard_name :
- longitude
- long_name :
- Longitude
- units :
- degrees_east
array(11., dtype=float32)
- time_centered(time_counter)object4679-07-16 00:00:00 ... 4680-06-...
- standard_name :
- time
- long_name :
- Time axis
- time_origin :
- 1900-01-01 00:00:00
- bounds :
- time_centered_bounds
- cell_methods :
- time_counter: mean
array([cftime.Datetime360Day(4679, 7, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 8, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 9, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 10, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 11, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4679, 12, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 1, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 2, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 3, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 4, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 5, 16, 0, 0, 0, 0, has_year_zero=False), cftime.Datetime360Day(4680, 6, 16, 0, 0, 0, 0, has_year_zero=False)], dtype=object)
- standard_name :
- sea_surface_temperature
- long_name :
- sea_surface_temperature
- units :
- degC
- online_operation :
- average
- interval_operation :
- 4800 s
- interval_write :
- 1 month
- cell_methods :
- time: mean (interval: 4800 s) time_counter: mean
# Form [lon, lat]
coords = [
[-170, 80],
[-100, -80],
]
values = []
for coord in coords:
lon, lat = coord
y, x = find_nearest(ds.nav_lon.values, ds.nav_lat.values, lon, lat)
value = float(ds["tos"].isel(x=x, y=y).mean("time_counter"))
values.append(value)
print(f'lon: {lon}\tlat: {lat}\t value: {value}')
lon: -170 lat: 80 value: 0.07544342428445816
lon: -100 lat: -80 value: nan
values
[0.07544342428445816, nan]