Skip to content

Commit

Permalink
sort file list in read_aviso
Browse files Browse the repository at this point in the history
  • Loading branch information
yangleir committed Jul 30, 2020
1 parent 4b7ca03 commit 039e52c
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 59 deletions.
20 changes: 10 additions & 10 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Copyright (c) 2018-2018, First Institute of Oceanography, SOA.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the First Institute of Oceanography, SOA, may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE First Institute of Oceanography, SOA BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright (c) 2018-2018, First Institute of Oceanography, SOA.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the First Institute of Oceanography, SOA, may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE First Institute of Oceanography, SOA BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 changes: 27 additions & 23 deletions alti_read/read_aviso_mss.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,30 @@
import sys
import pickle

## -- Get the user home directory
# ---------------Introduction-----------------------------
# This is a simple program to read and process the AVISO monthly MSS data.
# First, you should download some data from AVISO FTP site. Then run this program and get the similar result.
# [email protected]
# 2020-07
# --------------------------------------------------------


# Get the user home directory
from os.path import expanduser
import os

home = expanduser("~")
# ------ Directory contains AVISO SLA data

# set directory containing AVISO SLA data. You should change this to your data location.
dir_setup = os.path.join(home, 'alti_data', 'avisoMMS')
# 定义变量
# define variables
msla = []
tims = []
for filename in os.listdir(dir_setup)[1:2]:
print(filename)

filelist = sorted(os.listdir(dir_setup)) # sort the file name list


for filename in filelist[1:]: # Try to select a small set of data and test it (like one year [1:12]). Otherwise, it will be slow to run all the data.
# print(filename)
# ------ Here we choose the enhanced data because it contains the waveform data.
file_path = os.path.join(dir_setup, filename)
print("The Aviso MSS grid file is:")
Expand All @@ -44,40 +56,32 @@
# print(np.shape(tim))
# print(np.shape(asla)) # 数据是二维的

print(tim)
print('time is:', tim)
# print(asla[0, 1:300, 1000])
# print(lat[100])


# -----------------------#
# select data in the south china sea at about 5-20 110-120
# Here we can change the selection from 'if' to 'slice' later to get faster. Need to fix.
# -----------------------#
tmp = []
for i in range(720):
for i in range(720): # 720 this is the resolution along latitude and 1440 is longitude.
for j in range(1440):
if lat[i] > 15 and lat[i] < 20:
if lon[j]>115 and lon[j]<120:
if isinstance(asla[0, i, j], float):
tmp2 = asla[0, i, j]
tmp.append(tmp2)
# ii = 0
# jj = 0
# for i in lat:
#
# for j in lon:
#
# if isinstance(asla[0, ii, jj], float):
# tmp2 = asla[0, ii, jj]
# print(ii, jj)
# ii = ii+1
# jj = jj+1
# tmp.append(tmp2)

print(len(tmp))

# print(len(tmp))
tmp3 = np.mean(tmp)
msla.append(tmp3)
tims.append(tim)
print('\n')
# 绘图,时间序列

# plot the time series of sea surface level over south china sea

plt.plot(tims, msla)
plt.show()

Expand Down
2 changes: 1 addition & 1 deletion alti_read/readsa3.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


# ------ Directory contains sentinel3A SRAL data
dir_setup = os.path.join('..\ex_data', 'S3A_SR_2_WAT____20181229T021438_20181229T025856_20190123T183000_2658_039_317______MAR_O_NT_003.SEN3')
dir_setup = os.path.join('../ex_data', 'S3A_SR_2_WAT____20181229T021438_20181229T025856_20190123T183000_2658_039_317______MAR_O_NT_003.SEN3')
# ------ Name of the SRAL file. There have three kinds of S3A data which are the enhanced,standard and the reduced data.
# ------ Here we choose the enhanced data because it contains the waveform data.
file_path = os.path.join(dir_setup, 'enhanced_measurement.nc')
Expand Down
53 changes: 28 additions & 25 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
# Read me

## Introduction
This software is aimed to read satellite altimetry data of the netCDF format. It is not finished yet!!!
The netCDF4 lib is used under python3.
This software is aimed to:
- Read Sentinel-3A SRAL data, including the waveform data, analysis data and show data in
figures.
- Apply AI algorithm to the waveform data to classify sea ice and sea water in the arctic ocean.
- ...
## data example
You can download data example from [here](https://www.jianguoyun.com/p/DfGdEB8Q2PCQBxidq9YC).

The waveform will be plotted as:
![](waveform.png)

## usage
- Download the py file and example data.
- Change to correct file dir in the py file.
## LICENSE
Copyright (c) 2019-2020 by the yanglei.

<b>altimeter_read</b> is released under the [GNU Lesser General Public License](http://www.gnu.org/licenses/lgpl.html) version 3 or any later version.
## Software support
For general questions, do not be hesitate contact me:yangleir@qq.com
# Read me

## Introduction
This software is aimed to read satellite altimetry data of the netCDF format. It is not finished yet!!!
The netCDF4 lib is used under python3.
This software is aimed to:
- Read Sentinel-3A SRAL data, including the waveform data, analysis data and show data in
figures.
- Apply AI algorithm to the waveform data to classify sea ice and sea water in the arctic ocean.
- ...
## data example
You can download data example from [here](https://www.jianguoyun.com/p/DfGdEB8Q2PCQBxidq9YC).

The waveform will be plotted as:
![](waveform.png)

The time series of AVISO MMS over South China Sea will be plotted like:
![](ssh.png)

## usage
- Download the py file and example data.
- Change to correct file dir in the py file.
## LICENSE
Copyright (c) 2019-2020 by the yanglei.

<b>altimeter_read</b> is released under the [GNU Lesser General Public License](http://www.gnu.org/licenses/lgpl.html) version 3 or any later version.
## Software support
For general questions, do not be hesitate contact me:yangleir@qq.com
Binary file added ssh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 039e52c

Please sign in to comment.