Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions examples/MOD05.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -17,7 +17,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -28,7 +28,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -57,7 +57,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -72,13 +72,13 @@
}
],
"source": [
"staremaster.conversions.gring2cover(granule.gring_lats, \n",
"staremaster.conversions.gring2cover(granule.gring_lats,\n",
" granule.gring_lons, 8).dtype"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -98,7 +98,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -107,7 +107,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -119,10 +119,10 @@
" ...,\n",
" [12, 12, 12, ..., 11, 11, 11],\n",
" [12, 12, 12, ..., 11, 11, 11],\n",
" [12, 12, 12, ..., 11, 11, 11]])"
" [12, 12, 12, ..., 11, 11, 11]], shape=(406, 270))"
]
},
"execution_count": 9,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -141,7 +141,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "stare2",
"language": "python",
"name": "python3"
},
Expand All @@ -155,7 +155,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
"version": "3.13.2"
}
},
"nbformat": 4,
Expand Down
820 changes: 149 additions & 671 deletions examples/MOD09.ipynb

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions staremaster/create_sidecar_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@
import re


def create_grid_sidecar(grid, out_path, n_workers):
def create_grid_sidecar(grid, out_path, n_workers, for_mcms):
grid = grid.lower()
if grid == 'imerg':
granule = staremaster.products.IMERG()
elif grid[0] == 'h' and grid[3] == 'v':
granule = staremaster.products.ModisTile(grid)
elif grid == 'snodas':
granule = staremaster.products.SNODAS()
granule.load()
elif grid == 'merra2':
granule = staremaster.products.MERRA2(for_mcms)
granule.load()
else:
print('unknown grid')
exit()
Expand Down Expand Up @@ -46,6 +52,10 @@ def create_sidecar(file_path, n_workers, product, cover_res, out_path, archive):
granule = staremaster.products.ATMS(file_path)
elif product == 'GOES_ABI_FIXED_GRID':
granule = staremaster.products.GOES_ABI_FIXED_GRID(file_path)
elif product == 'SNODAS':
granule = staremaster.products.SNODAS(file_path)
elif product == 'MERRA2':
granule = staremaster.products.MERRA2(file_path)
else:
print('product not supported')
print('supported products are {}'.format(get_installed_products()))
Expand All @@ -64,7 +74,7 @@ def list_granules(folder, product):
if not product:
product = ''
files = glob.glob(folder + '/*')
pattern = '.*{product}.*[^_stare]\.(nc|hdf|HDF5)'.format(product=product.upper())
pattern = '.*{product}.*[^_stare]\.(nc4|nc|hdf|HDF5)'.format(product=product.upper())
granules = list(filter(re.compile(pattern).match, files))
return granules

Expand Down Expand Up @@ -122,6 +132,8 @@ def main():
Record all create sidecars and their corresponding granules in it.''')
parser.add_argument('--parallel_files', dest='parallel_files', action='store_true',
help='Process files in parallel rather than looking up SIDs in parallel')
parser.add_argument('--as_mcms', metavar='as_mcms', type=int,
help='MCMS specific layout for MERRA2 grid', default=0)

parser.set_defaults(archive=False)
parser.set_defaults(parallel_files=False)
Expand All @@ -133,7 +145,7 @@ def main():
elif args.folder:
file_paths = list_granules(args.folder, product=args.product)
elif args.grid:
create_grid_sidecar(args.grid, args.out_path, n_workers=args.workers)
create_grid_sidecar(args.grid, args.out_path, n_workers=args.workers, for_mcms=args.as_mcms)
quit()
else:
print('Wrong usage; need to specify a folder, file, or grid\n')
Expand Down
4 changes: 2 additions & 2 deletions staremaster/find_missing_sidecars.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

def get_granule_paths(folder, granule_pattern):
granule_paths = sorted(glob.glob(os.path.expanduser(folder) + '/' + '*' ))
pattern = '.*/{}.*[^_stare]\.(nc|hdf|HDF5)'.format(granule_pattern)
pattern = '.*/{}.*[^_stare]\.(nc4|nc|hdf|HDF5)'.format(granule_pattern)
granule_paths = list(filter(re.compile(pattern).match, granule_paths))
return granule_paths


def get_sidecar_paths(folder, granule_pattern):
sidecar_paths = sorted(glob.glob(os.path.expanduser(folder) + '/' + '*' ))
pattern = '.*/{}.*_stare\.(nc|hdf|HDF5)'.format(granule_pattern)
pattern = '.*/{}.*_stare\.(nc4|nc|hdf|HDF5)'.format(granule_pattern)
sidecar_paths = list(filter(re.compile(pattern).match, sidecar_paths))
return sidecar_paths

Expand Down
2 changes: 2 additions & 0 deletions staremaster/products/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
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.snodas import SNODAS
from staremaster.products.merra2 import MERRA2
Loading