Skip to content

Commit

Permalink
Feature/fix swot alignment (#51)
Browse files Browse the repository at this point in the history
* update changelog
  • Loading branch information
sliu008 authored Feb 20, 2024
1 parent a30d8d4 commit 90e147c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- update tig to upload tig image to ecr
- ** Add palette support to generating configuration **
- [issue/44] (https://github.com/podaac/hitide/issues/44): Add support to palette, ppd, fill_missing in csv in generating configuration
- ** Fix swot 2.0 alignment issue **
- Added way to use global grid for region if it is in hitide configurations
### Changed
### Deprecated
### Removed
Expand Down
20 changes: 12 additions & 8 deletions podaac/tig/tig.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ def _crosses(self, lons):
prev = x_val
continue
if prev > 0 > x_val and prev - x_val > 200:
self.logger.debug("prev, x: %s, %s", prev, x_val)
self.logger.debug(f"prev, x: {prev}, {x_val}")
result = True
elif x_val > 0 > prev and x_val - prev > 200:
self.logger.debug("prev, x: %s, %s", prev, x_val)
self.logger.debug(f"prev, x: {prev}, {x_val}")
result = True
return result

Expand Down Expand Up @@ -399,7 +399,7 @@ def generate_images(self, image_format='png', nearest=False, world_file=False, g
List of output image file locations
"""

self.logger.info("\nProcessing %s", self.input_file)
self.logger.info(f"\nProcessing {self.input_file}")
output_images = []
if self.config.get('multi_lon_lat'):
for group in self.config.get('multi_groups'):
Expand Down Expand Up @@ -452,7 +452,11 @@ def generate_images_group(self, image_format='png', nearest=False, world_file=Fa
# Image spans antimeridian, wrap it.
self.logger.debug("Region crosses 180/-180")
region = (southern, northern, -180, 180)
self.logger.info("region: %s", str(region))

if self.config.get('global_grid', False):
region = (-90, 90, -180, 180)

self.logger.info(f"region: {region}")
height_deg = region[1] - region[0]
width_deg = region[3] - region[2]
self.region = Region(region)
Expand Down Expand Up @@ -616,7 +620,7 @@ def process_variable(self,

# Get variable name
config_variable = var['id']
self.logger.info('variable: %s', config_variable)
self.logger.info(f'variable: {config_variable}')

group, _, variable = config_variable.rpartition('/')
if param_group:
Expand All @@ -636,7 +640,7 @@ def process_variable(self,
local_dataset.close()

# Get palette info
self.logger.info('palette: %s', var['palette'])
self.logger.info(f"palette: {var['palette']}")
colormap = load_json_palette(self.palette_dir, var['palette'], alpha)

# Set the output location
Expand Down Expand Up @@ -676,7 +680,7 @@ def process_variable(self,
cmap=colormap,
format=image_format)

self.logger.info("Wrote %s", output_location)
self.logger.info(f"Wrote {output_location}")

# Create world file if specified
if world_file:
Expand All @@ -687,7 +691,7 @@ def process_variable(self,
self.region.min_lon)
with open(output_wld, 'w') as wld:
wld.write(wld_string)
self.logger.info("Wrote %s", output_wld)
self.logger.info(f"Wrote {output_wld}")

except grids.GridDefinitionError:
self.logger.warning("Could not grid variable %s", variable.split('/')[-1], exc_info=True)
Expand Down
2 changes: 1 addition & 1 deletion terraform/tig_ecr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ resource null_resource ecr_login {
provisioner "local-exec" {
interpreter = ["/bin/bash", "-e", "-c"]
command = <<EOF
docker login ${data.aws_ecr_authorization_token.token.proxy_endpoint} -u AWS -p ${data.aws_ecr_authorization_token.token.password}
echo ${data.aws_ecr_authorization_token.token.password} | docker login -u AWS --password-stdin ${data.aws_ecr_authorization_token.token.proxy_endpoint}
EOF
}
}
Expand Down

0 comments on commit 90e147c

Please sign in to comment.