Skip to content

Commit

Permalink
now prints lat lon in fortran input file
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptisteVandecrux committed Sep 28, 2022
1 parent 46c4269 commit ee78629
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions sice_f.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#import bav_lib as bl
import pandas as pd
import rioxarray
import xarray as xr
import shutil
import glob
import subprocess
Expand All @@ -27,6 +28,14 @@
start_time = time.time()
InputFolder = InputFolder + "/"
Oa01 = rio.open(InputFolder + "r_TOA_01.tif")
band1 = Oa01.read(1)
height = band1.shape[0]
width = band1.shape[1]
cols, rows = np.meshgrid(np.arange(width), np.arange(height))
xs, ys = rio.transform.xy(Oa01.transform, rows, cols)
lons= np.array(xs)
lats = np.array(ys)
print('lons shape', lons.shape)
meta = Oa01.meta

def WriteOutput(var, var_name, in_folder):
Expand Down Expand Up @@ -56,10 +65,10 @@ def WriteOutput(var, var_name, in_folder):

olci_toa = np.vstack(
(
np.arange(1, len(sza.flatten()) + 1), # pixel number_x
np.arange(1, len(sza.flatten()) + 1), # pixel number_y
np.arange(1, len(sza.flatten()) + 1), # latitude
np.arange(1, len(sza.flatten()) + 1), # longitude
cols.flatten(), # pixel number_x
rows.flatten(), # pixel number_y
lats.flatten(), # latitude
lons.flatten(), # longitude
sza.flatten(), # solar zenith angle
saa.flatten(), # soalr azimuthal angle
vza.flatten(), # viewing zenith angle
Expand Down

0 comments on commit ee78629

Please sign in to comment.