-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue523 s1l2 mapper #524
base: master
Are you sure you want to change the base?
Issue523 s1l2 mapper #524
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix two things: key word args explicitly in the init defintion and context manager for Dataset() ?
class Mapper(VRT): | ||
"""""" | ||
|
||
def __init__(self, file_src, gdal_dataset, gdal_metadata, *args, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def __init__(self, file_src, gdal_dataset, gdal_metadata, *args, **kwargs): | |
def __init__(self, file_src, gdal_dataset, gdal_metadata, subswath_id=0, product='rvl', dop_time = False, **kwargs): |
Like in : https://github.com/nansencenter/nansat/blob/master/nansat/mappers/mapper_sentinel1_l1.py
# Check if the subswath number [1, 2, 3] is provided | ||
# Subswath number is required for mapping the RVL products | ||
if 'subswath_n' in kwargs.keys(): | ||
subswath_id = kwargs['subswath_n'] - 1 | ||
else: | ||
subswath_id = 0 | ||
# Check if the product type is provided: rvl | ||
if 'product_type' in kwargs.keys(): | ||
product = kwargs['product_type'] | ||
else: | ||
product = 'rvl' | ||
|
||
if 'dop_time' in kwargs.keys(): | ||
dop_time = kwargs['dop_time'] | ||
else: | ||
dop_time = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Check if the subswath number [1, 2, 3] is provided | |
# Subswath number is required for mapping the RVL products | |
if 'subswath_n' in kwargs.keys(): | |
subswath_id = kwargs['subswath_n'] - 1 | |
else: | |
subswath_id = 0 | |
# Check if the product type is provided: rvl | |
if 'product_type' in kwargs.keys(): | |
product = kwargs['product_type'] | |
else: | |
product = 'rvl' | |
if 'dop_time' in kwargs.keys(): | |
dop_time = kwargs['dop_time'] | |
else: | |
dop_time = False |
else: | ||
dop_time = False | ||
# Read the NetCDF dataset | ||
nc_dataset = Dataset(file_src) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If something goes wrong nc is not closed -potential memory leak.
Its is better to always use
with Dataset(file_src) as nc_dataset:
all_the_data = nc_dataset['all_the_data']
New mapper for s1 iw l2 data with the support of the owi and rvl products