barronh / pseudonetcdf

PseudoNetCDF like NetCDF except for many scientific format backends
GNU Lesser General Public License v3.0
76 stars 35 forks source link

Losing dimension names when subsetting the cmaq output over space and time #139

Closed praful-dodda closed 1 year ago

praful-dodda commented 1 year ago

Please see how I am reading the data and subset the data for the given lat-lon and time range ` import pandas as pd import PseudoNetCDF as pnc from datetime import datetime import pytz

cmaq_file_path = ""HR2DAY_LST_ACONC_EQUATES_v532_12US1_2019.nc" cmaq_data = pnc.pncopen(cmaq_file_path , format='ioapi')

sub_lon = [-125, -114] sub_lat = [32, 42]

sub_time = [datetime(2019, 10, 1, tzinfo = pytz.utc), datetime(2019, 12, 31, tzinfo = pytz.utc)] i, j = cmaq_data.ll2ij(sub_lon, sub_lat) k = i * 0 t = cmaq_data.time2t(sub_time)

sub_cmaq_data = cmaq_data.sliceDimensions(ROW = j, COL = i, LAY = k, TSTEP = t) `

Here cmaq_data and sub_cmaq_data have different dimension names. cmaq_data.dimensions.keys() sub_cmaq_data.dimensions.keys()