Skip to content
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ staremaster/_version.py export-subst
*.nc filter=lfs diff=lfs merge=lfs -text
*.hdf filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.TIF filter=lfs diff=lfs merge=lfs -text
23 changes: 21 additions & 2 deletions staremaster/create_sidecar_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,27 @@ def list_granules(folder, product):

def product_name(file_path):
file_name = file_path.split('/')[-1]
product_name = file_name.split('.')[0]
return product_name
if 'MOD05_L2' in file_path and '.hdf' in file_name:
product = 'MOD05'
elif 'MOD09' in file_path and '.hdf' in file_name:
product = 'MOD09'
elif ('VNP03' in file_path or 'VJ103' in file_path) and '.nc' in file_name:
product = 'VNP03'
elif ('VNP02DNB' in file_path or 'VJ102DNB' in file_path) and '.nc' in file_name:
product = 'VNP02DNB'
elif 'CLDMSK_L2_VIIRS' in file_path and '.nc' in file_name:
product = 'CLDMSK_L2_VIIRS'
elif 'SSMIS' in file_path and '.HDF5' in file_name:
product = 'SSMIS'
elif 'ATMS' in file_path and '.HDF5' in file_name:
product = 'ATMS'
elif 'MERRA2' in file_path and '.nc4' in file_name:
product = 'MERRA2'
else:
product = None
print('could not determine product for {}'.format(file_path))
quit()
return product


def remove_archived(file_paths, archive):
Expand Down
1 change: 1 addition & 0 deletions staremaster/products/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
from staremaster.products.satcorps import satCORPS
from staremaster.products.modis_tilegrid import ModisTile
from staremaster.products.goes_abi_fixed_grid import GOES_ABI_FIXED_GRID
from staremaster.products.merra2 import MERRA2
2 changes: 1 addition & 1 deletion staremaster/products/hdfeos.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def make_sids(self, n_workers):
for res in self.nom_res:
sids = staremaster.conversions.latlon2stare(self.lats[res], self.lons[res],
resolution=None, n_workers=n_workers, adapt_resolution=True)
sids = numpy.ma.array(sids, mask=self.lats[res].mask, fill_value=-1)
sids = numpy.ma.array(sids, mask=self.lats[res].mask, fill_value=0)
self.sids[res] = sids

def get_cover_res_from_sids(self):
Expand Down
4 changes: 2 additions & 2 deletions staremaster/products/imerg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def __init__(self):
self.lons = None
self.nom_res = ''
self.sids = []
self.make_latlon()
self.get_latlon()

def make_latlon(self):
def get_latlon(self):
self.lats = numpy.ascontiguousarray(numpy.tile(numpy.arange(-89.95, 90, 0.1), (3600, 1)).transpose())
self.lons = numpy.tile(numpy.arange(-179.95, 180, 0.1), (1800, 1))

Expand Down
626 changes: 626 additions & 0 deletions staremaster/products/merra2.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion staremaster/sidecar.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def write_lats(self, lats, nom_res=None, group=None, fill_value=None):
lats_netcdf.units = 'degrees_north'
lats_netcdf[:, :] = lats

def write_sids(self, sids, nom_res=None, group=None, fill_value=-1):
def write_sids(self, sids, nom_res=None, group=None, fill_value=0):
i = sids.shape[0]
j = sids.shape[1]
varname = 'STARE_index'.format(nom_res=nom_res)
Expand Down
Binary file not shown.
Binary file modified tests/data/mod05/MOD05_L2.A2019336.0000.061.2019336211522_stare.nc
Binary file not shown.
Binary file modified tests/data/mod05/MOD05_L2.A2020254.1320.061.2020255013126_stare.nc
Binary file not shown.
Git LFS file not shown
1 change: 1 addition & 0 deletions tests/test_mod05.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def test_make_sidecar():
granule = staremaster.products.mod05.MOD05(file_path)
granule.read_latlon()
granule.read_gring()
granule.make_sids(n_workers=1)
granule.create_sidecar(n_workers=1, cover_res=None, out_path=None)

sidecar_path = 'tests/data/mod05/MOD05_L2.A2005349.2125.061.2017294065400_stare.nc'
Expand Down