Skip to content

Commit

Permalink
Fixed paths that broke from moving script, changed name of logger, re…
Browse files Browse the repository at this point in the history
…moved unnecessary reopening of model_grid
  • Loading branch information
Utheri Wagura authored and Utheri Wagura committed Nov 15, 2024
1 parent 109d233 commit c87c4a8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions diagnostics/biogeochemistry/NWA12/chl_eval_regional.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Compare model surface chla with data from occci-v6.0 over a subset of the NWA domain
How to use:
python chl_eval_regional.py -p /archive/acr/fre/NWA/2023_04/NWA12_COBALT_2023_04_kpo4-coastatten-physics/gfdl.ncrc5-intel22-prod -c ../physics/config.yaml
python chl_eval_regional.py -p /archive/acr/fre/NWA/2023_04/NWA12_COBALT_2023_04_kpo4-coastatten-physics/gfdl.ncrc5-intel22-prod -c ../config.yaml
"""
import cartopy.crs as ccrs
from cartopy.mpl.geoaxes import GeoAxes
Expand All @@ -15,20 +15,20 @@
import matplotlib.colors as colors
from string import ascii_lowercase
import logging
import os
from pathlib import Path
import sys

# Get the directory of the current script
script_dir = os.path.dirname(os.getcwd())
sys.path.append(os.path.join(script_dir, 'physics'))
# Add physics/plot_common to path in order to access tools located there
diag_dir = Path.cwd().parent.parent
sys.path.append( str( diag_dir.joinpath('physics') ) )
from plot_common import add_ticks, autoextend_colorbar, corners, annotate_skill, open_var, save_figure, load_config

# Configure logging
logger = logging.getLogger(__name__)
logging.basicConfig(filename="chl_eval.log", format='%(asctime)s %(levelname)s:%(name)s: %(message)s',level=logging.INFO)
logging.basicConfig(filename="chl_eval_regional.log", format='%(asctime)s %(levelname)s:%(name)s: %(message)s',level=logging.INFO)

def plot_chl_regional(pp_root, label, config, dev):
model_grid = xarray.open_dataset( config['model_grid'] )
model_grid = xarray.open_dataset( "../../data/geography/ocean_static.nc" )
model = open_var(pp_root, 'ocean_cobalt_omip_sfc', 'chlos') * 1e6 # kg m-3 -> mg m-3
if dev:
print('Using any available model data')
Expand Down Expand Up @@ -63,7 +63,6 @@ def plot_chl_regional(pp_root, label, config, dev):
logger.info("SAT_RG: %s",sat_rg)
logger.info("DELTA: %s",sat_rg)
logger.info("Successfully regridded satellite data")
model_grid = xarray.open_dataset( config['model_grid'] )

PC = ccrs.PlateCarree()

Expand Down

0 comments on commit c87c4a8

Please sign in to comment.