Skip to content

Commit

Permalink
Deployment test 16.
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiabernat committed Jan 12, 2025
1 parent aacbc0b commit 618fe9b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
14 changes: 9 additions & 5 deletions dash_app/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,33 @@

if CONNECT_TO_LAMBDA:

print("DEPLOYMENT 15")
print("DEPLOYMENT 16")

SERVE_LOCALLY = False
DATASET_ID = "1ffea-emt93" # MSD-LIVE added dataset id that goes to DEV
DATA_DIR = ""
LAMBDA_TASK_ROOT = os.getenv('LAMBDA_TASK_ROOT')
DIR = os.path.join(LAMBDA_TASK_ROOT, "dash_app")

if LAMBDA_TASK_ROOT is None:
print(" ********** ", "LAMBDA_TASK_ROOT is None")
METADATA_DIR = './metadata'
METADATA_DIR = "./metadata"
DATA_DIR = "./data"
else:
print("********** LAMBDA_TASK_ROOT is ", os.getenv('LAMBDA_TASK_ROOT'))
METADATA_DIR = os.path.join(LAMBDA_TASK_ROOT, "dash_app", "metadata")
METADATA_DIR = os.path.join(DIR, "metadata")
DATA_DIR = os.path.join(DIR, "data")

else:
DATA_DIR = "../../data/msdlive-gridcerf"
CERF_DATA_DIR = "../../data/msdlive-gridcerf"
METADATA_DIR = "./metadata"
DATA_DIR = "./data"
LAMBDA_TASK_ROOT = ""
SERVE_LOCALLY = True

print("SERVE_LOCALLY is ", SERVE_LOCALLY)

COMPILED_DIR = os.path.join(DATA_DIR, "gridcerf/compiled/compiled_technology_layers")
COMPILED_DIR = os.path.join(CERF_DATA_DIR, "gridcerf/compiled/compiled_technology_layers")
OUTDIR = "tmp"

# REMINDER = "It's coors = (lat, lon) and ... LON = COLS = X ... LAT = ROWS = Y"
7 changes: 4 additions & 3 deletions dash_app/src/deckgl.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@
# SOURCED SCRIPTS
from src.reader import open_as_raster
from layout import cache, list_of_dicts
from definitions import OUTDIR, DATA_DIR, LAMBDA_TASK_ROOT #, MAPBOX_TOKEN
from definitions import OUTDIR, CERF_DATA_DIR, LAMBDA_TASK_ROOT, DATA_DIR #, MAPBOX_TOKEN

# DATA PATHS
STATES = "https://raw.githubusercontent.com/PublicaMundi/MappingAPI/refs/heads/master/data/geojson/us-states.json"
OCEAN_PATH = os.path.join(LAMBDA_TASK_ROOT, "data/ne_50m_ocean.geojson")
OCEAN_PATH = os.path.join(DATA_DIR, "ne_50m_ocean.geojson")
# /var/task/data/ne_50m_ocean.geojson
LAND = "https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_admin_0_scale_rank.geojson"

def read_layer(is_compiled, COMPILED_DIR, fpaths):
Expand All @@ -54,7 +55,7 @@ def read_layer(is_compiled, COMPILED_DIR, fpaths):
if is_compiled:
TIFPATH = os.path.join(COMPILED_DIR, fpaths[0])
else:
TIFPATH = os.path.join(DATA_DIR, fpaths[0])
TIFPATH = os.path.join(CERF_DATA_DIR, fpaths[0])
# print(TIFPATH) # ../../data/msdlive-gridcerf/gridcerf/compiled/compiled_technology_layers/ssp5/2025/biomass/gridcerf_biomass_conventional_no-ccs_dry.tif
data_df, array, source_crs, geo_crs, df_coors_long, boundingbox, img = open_as_raster(TIFPATH=TIFPATH, is_reproject=True, is_convert_to_png=False)

Expand Down

0 comments on commit 618fe9b

Please sign in to comment.