2 Comments

  1. I am trying to extract monthly mean of a vertical profile variable mass mixing ratio(MMR) from a netcdf file Data Link for the duration 2000-2003 for a region (longitude -45W to 10E and latitude 30-40E)and a point (lat=37 deg, lon=-40) and also for entire geographical region. Task:

    1. Extract monthly MMR at 400-450, 450-500,500-550,550-600 hpa for the region and the point during 2000-2003.
    2. Extract monthly ozone MMR at between two pressure levels as raster format.
  2. Hello,
    You can use Python xarray library to do some of these tasks.

    Before anything import xarray and read the data: 

    import xarray as xr
    
    #read the data:
    ds = xr.open_dataset('/path/to/data/ERA5_2000_03.nc')

    Select area using sel() method (note that latitudes are decreasing in your dataset this is why you put 40 then 30):

    ds_area  = ds.sel(latitude=slice(40,30),longitude=slice(-45,10))

    Select one point also using sel() method:

    one_point = ds.sel(latitude=37, longitude=-40)

    This will select the area or point for he whole dataset if you have more variables. You can do the same thing for each individual dataarray, for example something like this:

    one_point_o3 = ds.o3.sel(latitude=37, longitude=-40)

    You can use sel() method to filter any dimension, not only latitude and longitude, but time and level in this case, as well.

    If you want to calculate mean between 2 levels, you can do something like this:

    o3_400_450_mean = one_point_o3.o3.sel(level=slice(450,500)).mean('level')

    I am sure there are different ways to get all of this done, but I hope this helps.


    Best regards,

    Milana