{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e66a655b",
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "import combine_seawifs \n",
    "import create_seawifs_mask\n",
    "import xarray as xr\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "f1c59562",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([ 0,  0,  0, ..., 11, 11, 11]),\n",
       " array([  0,   0,   0, ..., 719, 719, 719]),\n",
       " array([   0,    1,    2, ..., 1437, 1438, 1439]))"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "diff_mask = xr.open_dataset(\"/glade/u/home/manishrv/documents/croc/diff_chl.nc\")\n",
    "np.where(diff_mask.chlor_a!=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "52d87bd6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([ 102,  102,  109, ..., 2097, 2097, 2098]),\n",
       " array([1779, 1842, 1923, ...,  276,  277,  287]))"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.where(diff_mask.Land!=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "ed7706c7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n",
      "5\n",
      "6\n",
      "7\n",
      "8\n",
      "9\n",
      "10\n",
      "11\n"
     ]
    }
   ],
   "source": [
    "combine_seawifs.combine_seawifs(\"/glade/u/home/manishrv/scratch/chl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9b7875d7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wrote emptyNetCDF file to:\n",
      "/glade/derecho/scratch/manishrv/chl/NEW_seawifs-clim-1997-2010-CalGulf.nc\n",
      "Data shape: 100 x 100 = 10000 with 8409 missing values\n",
      "Mask shape: 100 x 100 = 10000 with 8409 land cells\n",
      "Data has 0 missing values in ocean\n",
      "Data range: nan .. nan \n",
      "Building matrix\n",
      "Looping over cells\n",
      "Matrix constructed\n",
      "Matrix converted\n",
      "Matrix inverted\n",
      "Data shape: 100 x 100 = 10000 with 8409 missing values\n",
      "Mask shape: 100 x 100 = 10000 with 8409 land cells\n",
      "Data has 0 missing values in ocean\n",
      "Data range: nan .. nan \n",
      "Building matrix\n",
      "Looping over cells\n",
      "Matrix constructed\n",
      "Matrix converted\n",
      "Matrix inverted\n",
      "Data shape: 100 x 100 = 10000 with 8409 missing values\n",
      "Mask shape: 100 x 100 = 10000 with 8409 land cells\n",
      "Data has 0 missing values in ocean\n",
      "Data range: nan .. nan \n",
      "Building matrix\n",
      "Looping over cells\n",
      "Matrix constructed\n",
      "Matrix converted\n",
      "Matrix inverted\n",
      "Data shape: 100 x 100 = 10000 with 8409 missing values\n",
      "Mask shape: 100 x 100 = 10000 with 8409 land cells\n",
      "Data has 0 missing values in ocean\n",
      "Data range: nan .. nan \n",
      "Building matrix\n",
      "Looping over cells\n",
      "Matrix constructed\n",
      "Matrix converted\n",
      "Matrix inverted\n",
      "Data shape: 100 x 100 = 10000 with 8409 missing values\n",
      "Mask shape: 100 x 100 = 10000 with 8409 land cells\n",
      "Data has 0 missing values in ocean\n",
      "Data range: nan .. nan \n",
      "Building matrix\n",
      "Looping over cells\n",
      "Matrix constructed\n",
      "Matrix converted\n",
      "Matrix inverted\n",
      "Data shape: 100 x 100 = 10000 with 8409 missing values\n",
      "Mask shape: 100 x 100 = 10000 with 8409 land cells\n",
      "Data has 0 missing values in ocean\n",
      "Data range: nan .. nan \n",
      "Building matrix\n",
      "Looping over cells\n",
      "Matrix constructed\n",
      "Matrix converted\n",
      "Matrix inverted\n",
      "Data shape: 100 x 100 = 10000 with 8409 missing values\n",
      "Mask shape: 100 x 100 = 10000 with 8409 land cells\n",
      "Data has 0 missing values in ocean\n",
      "Data range: nan .. nan \n",
      "Building matrix\n",
      "Looping over cells\n",
      "Matrix constructed\n",
      "Matrix converted\n",
      "Matrix inverted\n",
      "Data shape: 100 x 100 = 10000 with 8409 missing values\n",
      "Mask shape: 100 x 100 = 10000 with 8409 land cells\n",
      "Data has 0 missing values in ocean\n",
      "Data range: nan .. nan \n",
      "Building matrix\n",
      "Looping over cells\n",
      "Matrix constructed\n",
      "Matrix converted\n",
      "Matrix inverted\n",
      "Data shape: 100 x 100 = 10000 with 8409 missing values\n",
      "Mask shape: 100 x 100 = 10000 with 8409 land cells\n",
      "Data has 0 missing values in ocean\n",
      "Data range: nan .. nan \n",
      "Building matrix\n",
      "Looping over cells\n",
      "Matrix constructed\n",
      "Matrix converted\n",
      "Matrix inverted\n",
      "Data shape: 100 x 100 = 10000 with 8409 missing values\n",
      "Mask shape: 100 x 100 = 10000 with 8409 land cells\n",
      "Data has 0 missing values in ocean\n",
      "Data range: nan .. nan \n",
      "Building matrix\n",
      "Looping over cells\n",
      "Matrix constructed\n",
      "Matrix converted\n",
      "Matrix inverted\n",
      "Data shape: 100 x 100 = 10000 with 8409 missing values\n",
      "Mask shape: 100 x 100 = 10000 with 8409 land cells\n",
      "Data has 0 missing values in ocean\n",
      "Data range: nan .. nan \n",
      "Building matrix\n",
      "Looping over cells\n",
      "Matrix constructed\n",
      "Matrix converted\n",
      "Matrix inverted\n",
      "Data shape: 100 x 100 = 10000 with 8409 missing values\n",
      "Mask shape: 100 x 100 = 10000 with 8409 land cells\n",
      "Data has 0 missing values in ocean\n",
      "Data range: nan .. nan \n",
      "Building matrix\n",
      "Looping over cells\n",
      "Matrix constructed\n",
      "Matrix converted\n",
      "Matrix inverted\n"
     ]
    }
   ],
   "source": [
    "interpolate_fill_seawifs.interpolate_and_fill_seawifs(\"/glade/derecho/scratch/manishrv/croc_input/marbl.bio.croc.3/ocnice/ocean_hgrid_nwa3_a8c564.nc\",\"/glade/derecho/scratch/manishrv/croc_input/marbl.bio.croc.3/ocnice/ocean_topog_nwa3_a8c564.nc\",\"/glade/derecho/scratch/manishrv/chl/NEW_SeaWIFS.L3m.MC.CHL.chlor_a.0.25deg.nc\",\"CalGulf\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
